OpenStack Beginner’s Guide - WordPress

Transcription

OpenStack Beginner’s Guide(for Ubuntu - Precise)v3.0, 7 May 2012Atul JhaJohnson DKiran MurariMurthy RajuVivek CherianYogesh Girikumar

OpenStack Beginner’s Guide(for Ubuntu - Precise)v3.0, 7 May 2012’Ubuntu’, the Ubuntu Logo and ’Canonical’ are registered trademarks of Canonical. ReadCanonical’s trademark policy here.CSS, CSS Corp., and the CSS Corp logos are registered trademarks of CSS Corp. Pvt. LtdAll other trademarks mentioned in the book belong to their respective owners.This book is aimed at making it easy/simple for a beginner to build and maintain a privatecloud using OpenStack. This book will be updated periodically based on the suggestions, ideas,corrections, etc., from readers.Mail Feedback to: css.ossbooks@csscorp.comPlease report bugs in the content of this book at :https://bugs.launchpad.net/openstackbook/ filebug and we will try to fix them as early aspossible and incorporate them in to the next version of the book.Released under Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unportedlicense.A brief description of the licenseA more detailed license text CCBYNCSA

PrefaceIntroductionWe released the OpenStack Beginner’s Guide - Diablo version a few months earlier and it wasmet with very positive response from users looking to set up a private cloud using OpenStack.OpenStack has since become a lot more stable and robust. There are some significant additionsto the component family that comprises a typical OpenStack cloud setup. We are excited to giveyou the next version of the guide which aims to help users get started with OpenStack Essexon Ubuntu 12.04 LTS (Precise Pangolin). In this book, we have included (along with severalnew content) sections that deal with the OpenStack identity service and the new OpenStack webinterface.Target AudienceOur aim has been to provide a guide for a beginners who are new to OpenStack. Good familiarity with virtualization is assumed, as troubleshooting OpenStack related problems requiresa good knowledge of virtualization. Similarly, familiarity with Cloud Computing concepts andterminology will be of help. Prior exposure to AWS API and/or tools is not mandatory, thoughsuch exposure will accelerate learning greatly.AcknowledgementMost of the content has been borrowed from web resources like manuals, documentation, whitepapers etc. from OpenStack and Canonical; numerous posts on forums; discussions on theOpenStack IRC Channel and many articles on the web including those of our colleagues at CSSCorp. We would like to thank the authors of all these resources.LicenseAttribution-Noncommercial-Share Alike 3.0 Unported. For the full version of the license text,please refer to egalcode and http://creativecommons.org/licenses/by-nc-sa/3.0 for a shorter description.

viPrefaceFeedbackWe would really appreciate your feedback. We will enhance the book on an ongoing basis basedon your feedback. Please mail your feedback to css.ossbooks@csscorp.com.OpenStack Beginner’s Guide: Ubuntu Precise Edition

OpenStack Compute Starter Guide1Contents1Introduction to OpenStack and Its Components71.1Cloud Computing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .71.2OpenStack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .71.2.1Open Stack Compute Infrastructure (Nova) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .81.2.1.1Functions and Features: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .91.2.1.2Components of OpenStack Compute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .91.2.21.2.31.2.4API Server (nova-api) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .91.2.1.2.2Message Queue (Rabbit MQ Server) . . . . . . . . . . . . . . . . . . . . . . . . . .91.2.1.2.3Compute Worker (nova-compute) . . . . . . . . . . . . . . . . . . . . . . . . . . . .91.2.1.2.4Network Controller (nova-network) . . . . . . . . . . . . . . . . . . . . . . . . . .91.2.1.2.5Volume Workers (nova-volume) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101.2.1.2.6Scheduler (nova-scheduler) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10OpenStack Imaging Service (Glance) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101.2.2.1Functions and Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101.2.2.2Components of Glance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10OpenStack Storage Infrastructure (Swift) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101.2.3.1Functions and Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111.2.3.2Components of Swift . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111.2.3.3Swift Proxy Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111.2.3.4Swift Object Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111.2.3.5Swift Container server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111.2.3.6Swift Account Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111.2.3.7The Ring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12OpenStack Identity Service (Keystone) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121.2.4.11.2.51.2.1.2.1Components of Identity Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12Openstack Administrative Web-Interface (Horizon) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

2Installation and Configuration152.1Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152.2Server1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152.2.1Base OS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162.2.2Network Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162.2.3NTP Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162.2.4Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172.2.52.2.62.2.4.1MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172.2.4.2Creating Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17Keystone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182.2.5.1Creating Tenants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192.2.5.2Creating Users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192.2.5.3Creating Roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192.2.5.4Listing Tenants, Users and Roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192.2.5.5Adding Roles to Users in Tenants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202.2.5.6Creating Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202.2.5.7Creating Endpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21Glance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222.2.6.12.2.72.2.8Glance Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22Nova . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232.2.7.1Nova Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232.2.7.2OpenStack Dashboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252.2.7.3Swift . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252.2.7.3.1Swift Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252.2.7.3.2Swift Storage Backends . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252.2.7.3.2.1Partition as a storage device . . . . . . . . . . . . . . . . . . . . . . . . . . . 262.2.7.3.2.2Loopback File as a storage device . . . . . . . . . . . . . . . . . . . . . . . 262.2.7.3.2.3Using the backend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272.2.7.3.3Configure Rsync. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272.2.7.3.4Configure Swift Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292.2.7.3.4.1Configure Swift Proxy Server . . . . . . . . . . . . . . . . . . . . . . . . . . 292.2.7.3.4.2Configure Swift Account Server . . . . . . . . . . . . . . . . . . . . . . . . 302.2.7.3.4.3Configure Swift Container Server . . . . . . . . . . . . . . . . . . . . . . . . 312.2.7.3.4.4Configure Swift Object Server . . . . . . . . . . . . . . . . . . . . . . . . . 322.2.7.3.4.5Configure Swift Rings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332.2.7.3.5Starting Swift services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332.2.7.3.6Testing Swift . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34Server2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342.2.8.1BaseOS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

OpenStack Compute Starter Guide2.2.932.2.8.2Network Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342.2.8.3NTP Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352.2.8.4Nova Components (nova-compute alone) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35Client1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362.2.9.1BaseOS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362.2.9.2Networking Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362.2.9.3NTP Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362.2.9.4Client Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372.2.9.5OpenStack Dashboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37Image Management393.1Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393.2Creating a Linux Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393.2.13.2.23.3OS Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393.2.1.1Ubuntu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403.2.1.2Fedora . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403.2.1.3OpenSUSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413.2.1.4Debian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413.2.1.5CentOS 6 and RHEL 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42Uploading the Linux image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42Creating a Windows Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423.3.1OS Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433.3.1.1453Uploading the Windows image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43Instance Management454.1Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454.2Openstack Command Line Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464.2.1Creation of Key Pairs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464.2.2Launch and manage instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46OpenStack Dashboard (Horizon)495.1Login . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495.2User Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505.2.1Instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505.2.2Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515.2.3Flavors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525.2.4Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535.2.5Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545.2.6Users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555.2.7Users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

5.35.465.3.2Instance

OpenStack has since become a lot more stable and robust. There are some signi cant additions to the component family that comprises a typical OpenStack cloud setup. We are excited to give you the next version of the guide which aims to help users get started with OpenStack Essex on Ubuntu 12.04 LTS (Precise Pangolin). In this book, we have included (along with several