This content is part of the Essential Guide: Learn the latest on OpenStack distributions and development
Manage Learn to apply best practices and optimize your operations.

How to install an OpenStack Nova compute cloud with Puppet

The open source cloud project, OpenStack, can be used to host private or public clouds. Learn how to install it using the Puppet configuration management tool on your Linux server.

OpenStack emerged from a partnership between Rackspace Cloud and NASA to provide cloud computing services running on standard hardware. It is now developed by a consortium of over 60 companies. OpenStack is Apache licensed and is composed of a number of smaller projects including Nova, the compute platform, and Swift, a massively scalable redundant storage system.

One method of using OpenStack is to use Puppet and install an OpenStack Nova compute cloud, which is what we will cover in this tip. The Nova compute component is roughly equivalent to Amazon EC2's capability. It allows you to deploy virtual machines from image files, including AMI images, and manage those deployed instances.

To start, we're going to build on an Ubuntu 11.04 host (ISOs for Ubuntu Natty). It's best to choose a physical host rather than a virtual machine, both for performance and because virtualizing inside a virtualization can have unpredictable results. You will need plenty of disk space, at least 10 GB to 20 GB, if you want to run a large number of different images.

Next, you need to install Puppet and Git on the host:

$ sudo apt-get install ruby rubygems git
$ sudo gem install puppet

Nova needs to be installed via a PPA or Personal Package Archive (PPA), which is a package repository containing the current development release of the Nova compute component. It's needed because Nova is under heavy development and recent packaged releases do not yet exist.

$ sudo apt-get install -y python-software-properties
$ sudo add-apt-repository ppa:nova-core/trunk

Next you need to update the APT repositories to get the details of the new PPA:

$ sudo apt-get update

Now, download the Puppet Labs OpenStack module from OpenStack using Git:

$ cd ~ && git clone --recurse git://

Copy the downloaded modules into the Puppet module path:

$ sudo cp -R ~/puppetlabs-openstack/modules/* /etc/puppet/

You now have everything needed to install Nova on this host. To do the actual installation you need to trigger a local Puppet to run on the host.

$ sudo puppet apply --verbose ~/puppetlabs-openstack/manifests/all.pp

This will run the all.pp Puppet manifest that will install and configure all the elements of Nova and its supporting packages and prerequisites.

Once Puppet has completed (which may take a while because it has to download a number of packages) then you need to add some images in AMI format.

$ cd /tmp
$ mkdir lucid_ami && cd lucid_ami
$ wget -q -O - | tar xSv

This will download and unpack a tarball containing an example Ubuntu Lucid image we can use to create instances. Then you will add these images, a ramdisk, a kernel and an OS image, to a service called Glance which is an OpenStack service for discovering, registering, and retrieving images.

First add the ramdisk and kernel.

$ glance add name=ramdisk disk_format=ari container_format=ari is_public=True < initrd.img-2.6.32-23-server
$ glance add name=kernel disk_format=aki container_format=aki is_public=True < vmlinuz-2.6.32-23-server

You can then list the images that have been added:

$ glance index
Found 2 public images...

ID               Name                           Disk Format          Container Format     Size         
---------------- ------------------------------ -------------------- -------------------- --------------
2                kernel                         aki                  aki                         4099360
1                ramdisk                        ari                  ari                         7988037

You should see your ramdisk image #1 and our kernel #2. You can then use these in conjunction with our Lucid operating system image and add that too:

$ glance add name=lucid_ami disk_format=ami container_format=ami is_public=True ramdisk_id=1 kernel_id=2 < ubuntu-lucid.img

Then list images again to see that you now have image #3 - an Ubuntu Lucid AMI that you will launch as a virtual instance.

$ glance index
Found 3 public images...
ID               Name                           Disk Format          Container Format     Size         
---------------- ------------------------------ -------------------- -------------------- --------------
3                lucid_ami                      ami                  ami                       524288000
2                kernel                         aki                  aki                         4099360
1                ramdisk                        ari                  ari                         7988037

You can add other images in a variety of formats to Glance as well.

Next you need to configure your access and credentials to Nova by running some Nova sub-commands that create a key pair to use to authenticate to our Nova instance (similar to using a key pair with Amazon AWS). The same commands will also create a Bash script to use to set appropriate environment variables to authenticate to Nova.

$ cd ~
$ sudo nova-manage project zipfile nova novaadmin

You should now have a file called that contains the keys and Bash script that needs to be unzipped:

$ unzip

Run the Bash script to populate our authentication and environment variables. You will need to run this script, or have it run as part of logon, before you interact with Nova from a command line session.

$ source novarc

Finally, add your key pair, calling the pair openstack:

$ euca-add-keypair openstack > ~/cert.pem

You can now use this key pair to run an instance. To look for an image to run:

$ nova image-list
| ID |    Name   | Status |
| 1  | ramdisk   | ACTIVE |
| 2  | kernel    | ACTIVE |
| 3  | lucid_ami | ACTIVE |

Then look for a flavor of this image to run. Flavors describe the size and type of the image you are going to run. In the Amazon AWS world this is the difference between a tiny, medium or large instance. You will see the flavors are similar to Amazon EC2.

$ nova flavor-list
| ID |    Name   | Memory_MB | Swap | Local_GB | VCPUs | RXTX_Quota | RXTX_Cap |
| 1  | m1.tiny   | 512       |      | 0        |       |            |          |
| 2  | m1.small  | 2048      |      | 20       |       |            |          |
| 3  | m1.medium | 4096      |      | 40       |       |            |          |
| 4  | m1.large  | 8192      |      | 80       |       |            |          |
| 5  | m1.xlarge | 16384     |      | 160      |       |            |          |

In this example, we will choose to run a tiny flavored instance of image ami-00000003, the Ubuntu Lucid image you just added, using the openstack keypair:

$ euca-run-instances ami-00000003 -k openstack -t m1.tiny

It'll take a couple of minutes to start and configure your instance and you can keep track of its status using the command:

$ euca-describe-instances
i-00000001      ami-00000003            building            m1.tiny

Here you see that the instance has started and an IP address of has been assigned. With this IP address and your keypair, you can now SSH into this new instance:

$ ssh -i ~/cert.pem root@

When you're logged into the new instance you can configure it, deploy applications on it and use it until you don't require it anymore (you can terminate instances with the euca-terminate-instance command). You can also spawn other instances and put yourself on the path to running your own open source cloud.

OpenStack is just getting started and a number of additional projects including an authentication and a database service are in the works, while the existing components are being extended and updated daily. If you want to get a bit deeper into OpenStack you can refer to the documentation or check out the mailing list where you can get help or get involved with development.

ABOUT THE AUTHOR: James Turnbull is head of Operations at Puppet Labs. He is a former IT executive in the banking industry and author of five technology books, including the just released Pro Puppet, as well as Pulling Strings with Puppet and Pro Linux System Administration. James has been involved in IT Operations for nearly twenty years and is an advocate of open source technology.

Dig Deeper on Linux servers

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.