Jump to: navigation, search

Obsolete:NovaInstallFestInstructions

{{:DeprecatedPage}}

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!

#Lucid Slice

#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

# 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

# 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

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

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

#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

#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

#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
# wait a while
ssh ubuntu@10.0.0.3   # password is ubuntu


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:

#Experimental
deb http://ftp.debian.org/debian experimental main


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
#LAUNCHPAD_ID="your-launchpad-name"
OPENSTACK_USERNAME=`whoami`

NOVA_SRC_BASE=~/openstack/nova
#DATA=/var/lib/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

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

#src the conf file to set variables in the environment
. conf

# Some basic packages
apt-get install --yes bzr unzip screen curl

# We need a bunch of python modules
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
# And RabbitMQ
sudo apt-get install --yes rabbitmq-server

# And kvm
sudo apt-get install --yes kpartx kvm
sudo modprobe kvm

# Install libvirt
sudo apt-get --yes install libvirt-bin libvirt0
sudo adduser `whoami` libvirtd

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

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


# Building Redis 2.0
# Lucid version of redis is 1.2, which doesn't support HMSET
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
# I don't know how to install Redis, so I run it from this directory...
# ?? sudo make install

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


# 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

# Build gflags
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

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

# 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' nova/compute/libvirt.xml.template

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

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

# Create first user
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}

# Create project
# 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)...
OPENSTACK_PROJECTNAME=${OPENSTACK_USERNAME}
#OPENSTACK_PROJECTNAME=${OPENSTACK_USERNAME}-project1
# 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} project create ${OPENSTACK_PROJECTNAME} ${OPENSTACK_USERNAME}


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

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

# Creates novarc, which contains your config
# . novarc

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

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

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

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"
# This hack is because otherwise the compute deamon also writes to twistd.log
mkdir -p objectstorelogs
cd objectstorelogs
../bin/nova-objectstore ${NOVA_OBJECTSTORE_ARGS} --nodaemon --verbose start

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

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"
# --datastore_path=/var/lib/nova/keeper"
bin/nova-compute ${NOVA_COMPUTE_ARGS} --nodaemon --verbose start

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

# This creates a 10GB file to create volumes out of
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}

. ~/openstack/conf
cd ${NOVA_SRC_BASE}

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

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


#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

# 26 July 2010 :The next commands will fail if you don't create the bucket prior to uploading
#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
# wait a while
ssh ubuntu@192.168.1.222   
# password is ubuntu