Getting started with OpenStack Nova

From FedoraProject

Revision as of 00:24, 30 August 2011 by Asalkeld (Talk | contribs)

Jump to: navigation, search

To get started with OpenStack's Compute Service (Nova), you can install it on Fedora 16 from a testing repository:

$> sudo wget -O /etc/yum.repos.d/fedora-openstack.repo http://repos.fedorapeople.org/repos/markmc/openstack/fedora-openstack.repo
$> sudo yum install --enablerepo=updates-testing  openstack-nova

Nova requires the RabbitMQ AMQP messaging server to be running:

$> sudo service rabbitmq-server start

It also currently requires iptables to be disabled:

$> sudo service iptables stop

And worse, SELinux needs to be disabled:

$> sudo setenforce 0

Next, you should enable the Glance API and registry services:

$> for svc in api registry; do sudo service openstack-glance-$svc start; done

The openstack-nova-volume service requires an LVM Volume Group called nova-volumes to exist. We simply create this using a loopback sparse disk image.

$> sudo dd if=/dev/zero of=/var/lib/nova/nova-volumes.img bs=1M seek=10k count=0
$> sudo vgcreate nova-volumes $(sudo losetup --show -f /var/lib/nova/nova-volumes.img)

Now you can start the various services:

$> for svc in api objectstore compute network volume scheduler; do sudo service openstack-nova-$svc start; done

Check that all the services started up correctly and look in the logs in /var/log/nova for errors. If there are none, then Nova is up and running!

To be able to try things out, we're going to need an image to run. You can be lazy and just download a set of images commonly used by OpenStack developers for testing and register those with Nova:

$> wget http://c2477062.cdn.cloudfiles.rackspacecloud.com/images.tgz
$> tar -xvzf images.tgz

Set the root password so you can ssh in later

$> mkdir mt ; sudo mount -o loop images/ami-tiny/image mt
$> sudo chroot mt
$> passwd
$> exit
$> sudo umount mt ; rmdir mt


$> sudo nova-manage image convert images/
$> glance index

The last command should return a list of the images registered with the Glance image registry.

Now you should create an admin user, project and network. I'm going to name them all after myself:

$> sudo nova-manage user admin markmc
$> sudo nova-manage project create markmc markmc
$> sudo nova-manage network create markmc 10.0.0.0/24 1 256 --bridge=br0

Then download a set of credentials for this user/project:

$> sudo nova-manage project zipfile markmc markmc
$> sudo chmod 600 nova.zip
$> sudo chown markmc:markmc nova.zip

Unpack the credentials, source the novarc and add an SSH keypair:

$> mkdir novacreds && cd novacreds
$> unzip ../nova.zip
$> . ./novarc
$> ssh-keygen -f nova_key
$> euca-add-keypair nova_key > nova_key.priv
$> chmod 600 nova*

You should now be able to launch an image, observe the instance running, observe the KVM VM running and SSH into the instance:

$> euca-run-instances ami-tiny --kernel aki-lucid --ramdisk ari-lucid -k nova_key
$> euca-describe-instances
$> sudo virsh list
$> ssh -i nova_key.priv 10.0.0.2