Obsolete:NovaInstallFestInstructions

= Installing Nova from Source Code =

This page was written for the first Install Fest, and we'll be repeating the Install Fest at the second Design Summit, but these are outdated. Still, we'll keep them around for the next Install Fest, and feel free to update these and remove the "outdated" warning if you update.

Check out Nova install instructions for scripts and a supplied image.

If you need a Cloud Server during the install fest, visit here: http://etherpad.openstack.org/HackDay-Slices

If you're having problems this is the order of all the steps:

DO THIS AS ROOT!


 * 1) Lucid Slice


 * 1) Paste these:

echo 'deb http://ppa.launchpad.net/soren/nova/ubuntu lucid main' >> /etc/apt/sources.list.d/soren-nova.list echo 'deb http://173.203.107.207/ubuntu ./' >> /etc/apt/sources.list.d/soren-nova.list gpg --keyserver hkp://keys.gnupg.net --recv-keys AB0188513FD35B23 gpg -a --export AB0188513FD35B23 | apt-key add - apt-get update apt-get install python-mox screen nova-compute nova-api nova-objectstore redis-server rabbitmq-server euca2ools unzip parted


 * 1) Then these:

/etc/init.d/nginx restart nova-manage user admin ant nova-manage project create antproj ant nova-manage project zip antproj ant unzip nova.zip


 * 1) If running in a slice, swap kvm for qemu:

sed -i -e "s/domain type='kvm'/domain type='qemu'/" -e s'!/usr/bin/kvm!/usr/bin/qemu-system-x86_64!g' /usr/share/nova/libvirt.xml.template

. novarc
 * 1) you need to be in the root of  where you unzipped nova.zip, then:

python /usr/bin/nova-objectstore --flagfile=/etc/nova/nova-objectstore.conf --nodaemonize start
 * 1) Run screen and paste this for the object store:


 * 1) Detach and check if object store is runningrun these:

wget -q -O - http://173.203.107.207/ubuntu-lucid.tar | tar xSv euca-bundle-image -i vmlinuz-2.6.32-23-server --kernel true euca-bundle-image -i initrd.img-2.6.32-23-server --ramdisk true euca-bundle-image -i ubuntu-lucid.img euca-upload-bundle -b mybucket -m /tmp/vmlinuz-2.6.32-23-server.manifest.xml euca-upload-bundle -b mybucket -m /tmp/initrd.img-2.6.32-23-server.manifest.xml euca-upload-bundle -b mybucket -m /tmp/ubuntu-lucid.img.manifest.xml


 * 1) Restart the api in another screen (you may need to remove a lock file):

python /usr/bin/nova-api --flagfile=/etc/nova/nova-api.conf stop python /usr/bin/nova-api --flagfile=/etc/nova/nova-api.conf --nodaemonize --verbose start


 * 1) Then paste this:

kernel=$(euca-register mybucket/vmlinuz-2.6.32-23-server.manifest.xml | awk '{print $2}') ramdisk=$(euca-register mybucket/initrd.img-2.6.32-23-server.manifest.xml | awk '{print $2}') machine=$(euca-register mybucket/ubuntu-lucid.img.manifest.xml | awk '{print $2}') euca-run-instances $machine --kernel $kernel --ramdisk $ramdisk ssh ubuntu@10.0.0.3  # password is ubuntu
 * 1) wait a while

Note: Those of you not named soren may want to use different user names and project names.

As we move forward more and more of the above will become unnecessary.

FYI: If you receive an error requiring redis-server 2.0.0rc1 or greater on Ubuntu/Debian you can fix it by doing the following:

Edit /etc/apt/sources.lists to include:

deb http://ftp.debian.org/debian experimental main
 * 1) Experimental

then Copy/Paste/Execute:

gpg --keyserver hkp://keys.gnupg.net --recv-key 9AA38DCD55BE302B gpg -a --export 9AA38DCD55BE302B | sudo apt-key add - apt-get update apt-get -t experimental install redis-server -V

Use the verbose output to confirm the installation is 2.0.0 rc1

Note: if you get an error while trying to run the apt-get update command that references a PGP key, replace the key in the above example with the key in your error message.

Instructions for getting it to work from source on Ubuntu Lucid Lynx.
These are assuming physical hardware (for now) - getting it running on a slice seems to require a lot more custom versions of dependencies. Warning - because the nova source is fast moving, these change often!:

mkdir ~/openstack

cd ~/openstack

cat > conf <<EOF OPENSTACK_USERNAME=`whoami`
 * 1) LAUNCHPAD_ID="your-launchpad-name"

NOVA_SRC_BASE=~/openstack/nova DATA=${NOVA_SRC_BASE}/../data KEYS_PATH=${DATA}/keys IMAGES_PATH=${DATA}/images BUCKETS_PATH=${DATA}/buckets INSTANCES_PATH=${DATA}/instances NETWORKS_PATH=${DATA}/networks CA_DIR=${NOVA_SRC_BASE}/CA
 * 1) DATA=/var/lib/nova

NETWORK_ARGS="--simple_network=true --simple_network_gateway=192.168.1.1 --simple_network_netmask=255.255.255.0 --simple_network_network=192.168.1.0 --simple_network_ips=192.168.1.220,192.168.1.221,192.168.1.222 --simple_network_bridge=br0 --simple_network_broadcast=192.168.1.255"

export PYTHONPATH=${NOVA_SRC_BASE} EOF

. conf
 * 1) src the conf file to set variables in the environment

apt-get install --yes bzr unzip screen curl
 * 1) Some basic packages

sudo apt-get --yes install python-m2crypto python-ipy python-twisted-bin python-twisted-core python-twisted-web python-carrot python-boto euca2ools python-libvirt python-daemon python-setuptools sudo apt-get install --yes rabbitmq-server
 * 1) We need a bunch of python modules
 * 1) And RabbitMQ

sudo apt-get install --yes kpartx kvm sudo modprobe kvm
 * 1) And kvm

sudo apt-get --yes install libvirt-bin libvirt0 sudo adduser `whoami` libvirtd
 * 1) Install libvirt


 * 1) logout and back in to add your user to the libvirtd group
 * 2) TODO: Is there a way to avoid logging out here???

cd ~/openstack bzr init-repo. bzr branch lp:nova cd nova
 * 1) Hopefully we don't need to log in now that the project is public
 * 2) don't you need your LP key installed first?
 * 3) bzr lp-login ${LAUNCHPAD_ID}

mkdir -p ~/openstack/src cd ~/openstack/src wget "http://redis.googlecode.com/files/redis-2.0.0-rc2.tar.gz" tar zxf redis-2.0.0-rc2.tar.gz cd redis-2.0.0-rc2 make
 * 1) Building Redis 2.0
 * 2) Lucid version of redis is 1.2, which doesn't support HMSET
 * 1) I don't know how to install Redis, so I run it from this directory...
 * 2) ?? sudo make install

cd ~/openstack/src git clone http://github.com/andymccurdy/redis-py.git cd redis-py/ python setup.py build sudo python setup.py install
 * 1) Building pyRedis
 * 2) Lucid version of python-redis client doesn't support HMSET (?)


 * 1) Building tornado (this might no longer be needed)

cd ~/openstack/src wget "http://www.tornadoweb.org/static/tornado-0.2.tar.gz" tar zxf tornado-0.2.tar.gz cd tornado-0.2 python setup.py build sudo python setup.py install

cd ~/openstack/src wget "http://google-gflags.googlecode.com/files/gflags-1.3.tar.gz" tar zxf gflags-1.3.tar.gz cd gflags-1.3 ./configure make sudo make install
 * 1) Build gflags

cd ~/openstack/src wget "http://python-gflags.googlecode.com/files/python-gflags-1.3.tar.gz" tar zxf python-gflags-1.3.tar.gz cd python-gflags-1.3 python setup.py build sudo python setup.py install


 * 1) If running in a slice, swap kvm for qemu:
 * 2) sed -i -e "s/domain type='kvm'/domain type='qemu'/" -e s'!/usr/bin/kvm!/usr/bin/qemu-system-x86_64!g' nova/compute/libvirt.xml.template

cd ${NOVA_SRC_BASE} cd ${CA_DIR} ./genrootca.sh
 * 1) Initialize our Certificate Authority (CA)
 * 1) mkdir -p ${CA_DIR}

cd ~/openstack/src/redis-2.0.0-rc2 ./redis-server
 * 1) Open new screen / window; start Redis 2

cd ${NOVA_SRC_BASE} NOVA_MANAGE_ARGS="--ca_path=${CA_DIR} --credentials_template=nova/auth/novarc.template --keys_path=${KEYS_PATH} --vpn_client_template=nova/cloudpipe/client.ovpn.template" bin/nova-manage ${NOVA_MANAGE_ARGS} user admin ${OPENSTACK_USERNAME}
 * 1) Create first user

OPENSTACK_PROJECTNAME=${OPENSTACK_USERNAME} bin/nova-manage ${NOVA_MANAGE_ARGS} project create ${OPENSTACK_PROJECTNAME} ${OPENSTACK_USERNAME}
 * 1) Create project
 * 2) There's a debate about whether nova-manage user admin should automatically create a project for you, with the same name as the user (bug 607527)...
 * 1) OPENSTACK_PROJECTNAME=${OPENSTACK_USERNAME}-project1
 * 2) This might fail, depending on the progress of bug 607527.  However, even if the project is still auto-created and this command fails, this helps to make sure that the VPN is created below

bin/nova-manage ${NOVA_MANAGE_ARGS} user list bin/nova-manage ${NOVA_MANAGE_ARGS} project list bin/nova-manage ${NOVA_MANAGE_ARGS} vpn list
 * 1) Just check that we're not FUBAR (no errors expected!!)

mkdir me bin/nova-manage ${NOVA_MANAGE_ARGS} project zip ${OPENSTACK_PROJECTNAME} ${OPENSTACK_USERNAME} me/nova.zip cd me/ unzip nova.zip
 * 1) Export credentials/config bundle to "me" subdir


 * 1) Creates novarc, which contains your config
 * 2) . novarc

sudo bash # Evil, but this does some VPN config I think . ~/openstack/conf cd ${NOVA_SRC_BASE}
 * 1) Open new screen; start API daemon

NOVA_API_ARGS="--ca_path=${CA_DIR} --keys_path=${KEYS_PATH} --fake_users=1 ${NETWORK_ARGS}" # --datastore_path=/var/lib/nova/keeper" echo NOVA_API_ARGS=${NOVA_API_ARGS} bin/nova-api ${NOVA_API_ARGS} --nodaemonize --verbose start

. ~/openstack/conf cd ${NOVA_SRC_BASE}
 * 1) Open new screen; start ObjectStore daemon

mkdir -p ${BUCKETS_PATH} mkdir -p ${IMAGES_PATH} NOVA_OBJECTSTORE_ARGS="--ca_path=${CA_DIR} --keys_path=${KEYS_PATH} --fake_users=1 ${NETWORK_ARGS} --images_path=${IMAGES_PATH} --buckets_path=${BUCKETS_PATH}" # --datastore_path=/var/lib/nova/keeper" mkdir -p objectstorelogs cd objectstorelogs ../bin/nova-objectstore ${NOVA_OBJECTSTORE_ARGS} --nodaemon --verbose start
 * 1) This hack is because otherwise the compute deamon also writes to twistd.log

sudo bash # Evil, but this does some disk mounting stuff . ~/openstack/conf cd ${NOVA_SRC_BASE}
 * 1) Open new screen; start up compute daemon

mkdir -p ${INSTANCES_PATH} mkdir -p ${NETWORKS_PATH} NOVA_COMPUTE_ARGS="--ca_path=${CA_DIR} --keys_path=${KEYS_PATH} --fake_users=1 ${NETWORK_ARGS} --images_path=${IMAGES_PATH} --use_s3=false --instances_path=${INSTANCES_PATH} --networks_path=${NETWORKS_PATH} --libvirt_xml_template=nova/compute/libvirt.xml.template --vpn_client_template=nova/cloudpipe/client.ovpn.template --credentials_template=/nova/auth/novarc.template" bin/nova-compute ${NOVA_COMPUTE_ARGS} --nodaemon --verbose start
 * 1) --datastore_path=/var/lib/nova/keeper"

sudo bash # Evil, but this does some LVM stuff etc
 * 1) Open new screen; start up volume daemon (if you're going to use volumes)

mkdir -p /volumes dd if=/dev/zero of=/volumes/fake.0 bs=128M count=80 LOOPBACK_MOUNT=`sudo losetup --show --find /volumes/fake.0` echo LOOPBACK_MOUNT=${LOOPBACK_MOUNT}
 * 1) This creates a 10GB file to create volumes out of

. ~/openstack/conf cd ${NOVA_SRC_BASE}

NOVA_VOLUME_ARGS="--storage_dev=${LOOPBACK_MOUNT}"

bin/nova-volume ${NOVA_VOLUME_ARGS} --nodaemonize --iscsi_storage=true --verbose start
 * 1) are you running from iSCSI? if not, comment out 2nd line and run first line:
 * 2) bin/nova-volume ${NOVA_VOLUME_ARGS} --nodaemonize --verbose start


 * 1) You should then be ready to proceed with register images & launching them:

wget -q -O - http://173.203.107.207/ubuntu-lucid.tar | tar xSv euca-bundle-image -i vmlinuz-2.6.32-23-server --kernel true euca-bundle-image -i initrd.img-2.6.32-23-server --ramdisk true euca-bundle-image -i ubuntu-lucid.img


 * 1) 26 July 2010 :The next commands will fail if you don't create the bucket prior to uploading
 * 2) https://bugs.launchpad.net/nova/+bug/607541

euca-upload-bundle -b mybucket -m /tmp/vmlinuz-2.6.32-23-server.manifest.xml euca-upload-bundle -b mybucket -m /tmp/initrd.img-2.6.32-23-server.manifest.xml euca-upload-bundle -b mybucket -m /tmp/ubuntu-lucid.img.manifest.xml

kernel=$(euca-register mybucket/vmlinuz-2.6.32-23-server.manifest.xml | awk '{print $2}') ramdisk=$(euca-register mybucket/initrd.img-2.6.32-23-server.manifest.xml | awk '{print $2}') machine=$(euca-register mybucket/ubuntu-lucid.img.manifest.xml | awk '{print $2}') euca-run-instances $machine --kernel $kernel --ramdisk $ramdisk ssh ubuntu@192.168.1.222
 * 1) wait a while
 * 1) password is ubuntu