Getting Images that Work with OpenStack
- Small test image: https://launchpad.net/cirros/+download
- Small test image [old]: http://smoser.brickies.net/ubuntu/ttylinux-uec/
- Ubuntu images: http://uec-images.ubuntu.com/
- Fedora images: https://fedoraproject.org/wiki/Getting_started_with_OpenStack_Nova#Building_an_Image_With_Oz
Once you have a fully functional Nova controller, the next logical thing you are going to want to do it spin up some instances. In lieu of multiple practices, we offer two suggested images as examples, one with a ramdisk, and one without.
As of recently, there has been some good progress with how images work within Nova. Before, any image used needed to be a single partition image, and needed a separate kernel and ramdisk. Today, this is no longer the case, and images without ramdisks are usable as well!
Smallest Downloadable Image - ttylinux
The first image is a very small linux image from Scott Moser (smoser). You will be able to ping and SSH to this instance, but it's not a full image.
Note
This is not a production-ready image, as it's a stripped down image made to be quickly bootable and testable.
Step 1 - Download the image, then use uec-publish-tarball to publish it:
image="cirros-0.3.0-x86_64-uec.tar.gz" wget https://launchpad.net/cirros/trunk/0.3.0/+download/$image uec-publish-tarball $image <bucket-name>
It should output three references: emi, eri and eki. You need to use the emi value in the next section (for example, “ami-lvdliy0″).
Step 2 - Generate credentials
Some images will require public keys to connect, and others will have built in accounts. This is a matter of how the author packaged the image.For this instance, you will use a keypair:
euca-add-keypair mykey > /root/mykey.priv chmod 0600 /root/mykey.priv
Step 3 - Launching and connecting to the instance
Ensure that you have created the emi value, and then use the euca-run-instances command to schedule and launch the instance.:
euca-run-instances $emi -k /root/mykey -t m1.tiny
This will return an instance ID (I got “i-1objiev”), an IP address (I got “192.168.0.3″), and the instance will be scheduled and launched. You should check the status with:
euca-describe-instances
The instance should quickly go from “launching” to “running”, and you should be able to connect to the root user through SSH (replace $ipaddress with the one you got from euca-describe-instances):
ssh -i mykey.priv root@$ipaddress
Base Networking Image - UECUbuntu
UECUbuntu 10.10 x64_86 image (no ramdisk) modified with local user account from http://uec-images.ubuntu.com/releases/10.10/release/
Note
You will be able to ping and SSH to this instance, and this is a full blown iso image. This image is modified to fit UEC standards, but it is more production ready. Namely, all of the base networking is included in this image.
Step 1 - Download the image, then use uec-publish-tarball to publish it:
image="ubuntu1010-UEC-localuser-image.tar.gz" wget http://c0179148.cdn1.cloudfiles.rackspacecloud.com/ubuntu1010-UEC-localuser-image.tar.gz uec-publish-tarball $image <bucket-name> <hardware-arch>
Example:
uec-publish-tarball ubuntu1010-UEC-localuser-image.tar.gz dub-bucket x86_64
It should output three references: emi, eri and eki. You need to use the emi value in the next section (I got “ami-zqkyh9th″).
Step 2 - Launching and connecting to the instance:
One thing to note here, once you publish the tarball, it has to untar before you can launch an image from it. Using the 'euca-describe-images' command, wait until the state turns to "available" from "untarring.":
euca-describe-images euca-run-instances $emi -k mykey -t m1.tiny
The instance will go from “launching” to “running” in a short time, and you should be able to connect via SSH using the 'ubuntu' account, with the password 'ubuntu': (replace $ipaddress with the one you got from euca-describe-instances):
ssh ubuntu@$ipaddress
The 'ubuntu' user is part of the sudoers group, so you can escalate to 'root' via the following command:
sudo -i
Deleting Instances
When you are done playing with an instance, you can tear the instance down using the following command (replace $instanceid with the instance IDs from above):
euca-terminate-instances $instanceid
Creating Custom Images
- CirrOS: The cirros build process is documented in the source code README
- Ubuntu: Ubuntu provides documentation on creating images using vmbuilder at https://help.ubuntu.com/community/UEC/CreateYourImage.
If you want to find out how to create or repurpose RHEL/Centos/OEL images click here.