Install Nova from source on Ubuntu Maverick Meerkat (10.10).

You'll need to ensure you can run kvm/qemu on the vm you create. Also, give your vm a lot of disk space since each instance will require about 10G by default (you can change this).

While Nova can run using sqlite, if you're running all the services on a single vm you may run into db locking issues. For this reason it is recommended to bite the bullet and use mysql.

Let's start off by installing some packages and python modules:

$ sudo add-apt-repository ppa:nova-core/trunk
$ sudo add-apt-repository ppa:glance-core/trunk
$ sudo add-apt-repository ppa:keystone-core/trunk
$ sudo apt-get update
$ sudo apt-get -y install python-m2crypto python-carrot python-boto euca2ools python-dev python-daemon python-setuptools python-routes python-sqlalchemy python-mox python-eventlet python-gflags python-libvirt python-mysqldb
$ sudo apt-get install python-paste python-pastedeploy python-netaddr python-novaclient python-glance python-keystone python-pip python-virtualenv
$ sudo apt-get -y install dnsmasq build-essential git-core unzip screen curl rabbitmq-server bridge-utils vlan kpartx libvirt-bin libvirt0 libxml2-dev libxslt1-dev gnutls-dev libdevmapper-dev iptables ebtables gawk mysql-server lvm2 kvm unzip libmysqlclient-dev mysql-client mysql-server libssl-dev swig
$ sudo /etc/init.d/dnsmasq stop
$ sudo update-rc.d -f dnsmasq remove
$ sudo usermod -a -G kvm `whoami`

Configure mysql

Edit /etc/mysql/my.cnf and set this line: bind-address=0.0.0.0 and then sighup or restart mysql

$ mysql -uroot -ppassword
> CREATE DATABASE nova;
> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
> SET PASSWORD FOR 'root'@'%' = PASSWORD('nova');

Register you ssh key with Launchpad

First, generate your keys. Accept all defaults and don't add a passphrase.

$ ssh-keygen
$ cat .ssh/id_rsa.pub

Grab the current Nova trunk

$ mkdir ~/openstack
$ cd ~/openstack

$ bzr whoami "First Last <first.last@domain.tld>"
$ bzr lp-login <user>
$ bzr init-repo .
$ bzr branch lp:nova

$ cd nova
$ mkdir instances
$ mkdir networks

$ cd nova/CA
$ ./genrootca.sh
$ cd ../..

The Volume manager is only required if you want to do EBS-like storage. If you don't have Volume Group named nova-volumes, the volume service will complain on startup. There is a good explanation here: https://answers.launchpad.net/nova/+question/134020 but the summary is

# This creates a 100M file to create volumes out of
$ dd if=/dev/zero of=MY_FILE_PATH bs=100M count=10
losetup --show -f MY_FILE_PATH
# replace /dev/loop0 below with whatever losetup returns
# nova-volumes is the default for the --volume_group flag
$ vgcreate nova-volumes /dev/loop0
$ lvcreate -L 80M -n test nova-volumes
#(if there is a folder named nova-volumes, success!)
$ ls /dev/nova*

The network and compute services often require sudo access for things like ifconfig/iptables/etc. If you're running nova as a user and not a privileged account, you may want to add the following to your sudoers file for development (NOT RECOMMENDED FOR PRODUCTION):

# replace mynovauser with your username
mynovauser ALL=(ALL) NOPASSWD:/sbin/iptables,/bin/kill,/sbin/vconfig,/sbin/ifconfig,/sbin/vgs

NOTE: If you're planning to use the FlatDHCPManager, create a new config /etc/nova/nova-dhcpbridge.conf with the flags from the config below before launching the network manager or the dhcpbridge script may default to sqlite. Failure to do so can result in misleading errors about "No network for br100" if you're using mysql as the instructions above suggest. Also, ensure you've exported DNSMASQ_INTERFACE=br100 as an environment variable.

Setup and start Nova

The default location for the nova.conf is in the bin/ directory under your working tree.

$ cat > bin/nova.conf << EOF
--verbose
--nodaemon
--cc_host=<host IP>
--routing_source_ip=<host IP>
--auth_driver=nova.auth.dbdriver.DbDriver
--sql_connection=mysql://root:nova@<host IP>/nova
--libvirt_type=qemu
EOF
exit

$ ./bin/nova-manage db sync
$ ./bin/nova-manage user admin <name>
$ ./bin/nova-manage project create <project> <name>
$ ./bin/nova-manage network create 10.0.0.0/8 3 16
$ ./bin/nova-manage project zipfile <project> <name>

$ unzip nova.zip

$ . novarc

$ cat > .screenrc << EOF
nonblock on
defnonblock on
vbell off
startup_message off

screen -t "api" 0
stuff "./bin/nova-api --flagfile=./bin/nova.conf --logfile=api.log\012"
screen -t "objectstore" 1
stuff "./bin/nova-objectstore --flagfile=./bin/nova.conf --logfile=objectstore.log\012"
screen -t "compute" 2
stuff "./bin/nova-compute --flagfile=./bin/nova.conf --logfile=compute.log\012"
screen -t "network" 3
stuff "./bin/nova-network --flagfile=./bin/nova.conf --logfile=network.log\012"
screen -t "volume" 4
stuff "./bin/nova-volume --flagfile=./bin/nova.conf --logfile=volume.log\012"
screen -t "scheduler" 5
stuff "./bin/nova-scheduler --flagfile=./bin/nova.conf --logfile=scheduler.log\012"
screen -t "bash" 6

hardstatus alwayslastline
hardstatus string '%{= .} %-Lw%{= .}%> %n%f %t*%{= .}%+Lw%< %-=%{g}(%{d}%H/%l%{g})'
# or (alternate status display)
#hardstatus string "%{= kw}%-w%{= BW}%n %t%{-}%+w %-= @%H - %LD %d %LM - %0c:%s"
EOF

$ screen -c .screenrc

Launch an image

$ wget http://c2477062.cdn.cloudfiles.rackspacecloud.com/images.tgz
$ tar zxvf images.tgz
$ rm images.tgz

$ ssh-keygen -f nova_key
$ chmod 600 nova_key
$ euca-add-keypair nova_key > nova_key.priv
$ euca-describe-images
$ euca-run-instances ami-tiny --kernel aki-lucid --ramdisk ari-lucid -k nova_key
$ euca-describe-instances
$ virsh list
$ ssh -i nova_key.priv root@10.0.0.3

Note: if you really have trouble with the virtual network stuff, you can change your nova-manage.conf file to include

--network_manager=nova.network.manager.FlatManager

and create the br100 interface with

$ brctl addbr br100 
$ brctl addif
$ ifconfig br100 1.2.3.4 netmask 255.255.255.0 gateway 1.2.3.1

You may need to reboot your vm and wipe your database if you make this switch as a lot of settings seem get cached/persisted.

Wiki: InstallFromSource (last edited 2012-01-14 10:49:38 by lzyeval)