Jump to: navigation, search

Difference between revisions of "Obsolete:NovaInstallFestInstructions"

Line 90: Line 90:
 
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.
 
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: (from Justin Santa Barbara)
+
Instructions for getting it to work from source: (from Justin Santa Barbara, WORK IN PROGRESS)
  
 
<pre><nowiki>
 
<pre><nowiki>

Revision as of 16:15, 21 July 2010

These is the stuff that you need to basically cut and paste to a fresh cloud server to get nova up and running:

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
. 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: (from Justin Santa Barbara, WORK IN PROGRESS)

---
Instructions for a Lucid slice on how to get up and running starting from source
*** WORK IN PROGRESS ***

LAUNCHPAD_ID=your-launchpad-name
OPENSTACK_USERNAME=your-preferred-openstack-username

NOVA_SRC_BASE=~/src/nova/nova
KEYS_PATH=/var/lib/nova/keys
IMAGES_PATH=/var/lib/nova/images
BUCKETS_PATH=/var/lib/nova/buckets
INSTANCES_PATH=/var/lib/nova/instances
NETWORKS_PATH=/var/lib/nova/networks
CA_DIR=${NOVA_SRC_BASE}/CA

Copy your SSH private key to the slice (!)

# Some basics
apt-get install --yes bzr unzip screen

# We need a bunch of python modules
apt-get --yes install python-m2crypto python-ipy python-tornado python-twisted-bin python-twisted-core python-carrot python-boto
apt-get install euca2ools python-libvirt python-daemon

# And RabbitMQ and Nginx
apt-get --yes install rabbitmq-server nginx


# And kvm
apt-get install --yes kpartx
# modprobe kvm
adduser root libvirtd

TODO: Is there a way to avoid logging out here???

mkdir ~/src
cd ~/src
## don't you need your LP key installed first?

bzr lp-login ${LAUNCHPAD_ID}
bzr init-repo nova
cd nova
bzr branch lp:nova

# 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


# Lucid version of python-redis doesn't support HMSET (?)
# Also, Soren has packaged python-gflags
# (It looks like soren's python-tornado PPA pulls in mysql-client??)
# Soren has also provided a version of libvirt that will work in a slice (at least I think that's the bug fixed?)
rm /etc/apt/sources.list.d/soren-nova.list
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-redis redis-server python-gflags libvirt-bin libvirt0 kvm

# python-tornado would pull in mysql-client

rm /etc/apt/sources.list.d/soren-nova.list
apt-get update

cd ~/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 ${NOVA_SRC_BASE}

#export PYTHONPATH=${NOVA_SRC_BASE}
echo ${NOVA_SRC_BASE} > /usr/local/lib/python2.6/dist-packages/nova.pth

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

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}

OPENSTACK_PROJECTNAME=${OPENSTACK_USERNAME}
#OPENSTACK_PROJECTNAME=${OPENSTACK_USERNAME}-project1
#bin/nova-manage ${NOVA_MANAGE_ARGS} project create ${OPENSTACK_PROJECTNAME} ${OPENSTACK_USERNAME}
#right now nova-manage user admin will automatically create a project for you, with the same name as the user, so you could cut out the above step.  Also you can specify an acess and secret key instead of having them auto-generated

mkdir me
bin/nova-manage ${NOVA_MANAGE_ARGS} project zip ${OPENSTACK_PROJECTNAME} ${OPENSTACK_USERNAME} me/nova.zip
cd me/
unzip nova.zip

. novarc

# Start up the OpenStack daemons in screen windows
screen

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

# [ Add screen, switch to it ]

mkdir -p ${BUCKETS_PATH}
mkdir -p ${IMAGES_PATH}
NOVA_OBJECTSTORE_ARGS="--ca_path=${CA_DIR} --keys_path=${KEYS_PATH} --fake_users=1 --images_path=${IMAGES_PATH} --buckets_path=${BUCKETS_PATH}" # --datastore_path=/var/lib/nova/keeper"
bin/nova-objectstore ${NOVA_OBJECTSTORE_ARGS} --nodaemonize --verbose start

# [ Add screen, switch to it ]
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 --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"

# the arg for this is --nodaemon since it uses twisted.  I'm moving nova-volume to twisted as well, which will mean --nodaemon will be used for nova-volume
bin/nova-compute ${NOVA_COMPUTE_ARGS} --nodaemon --verbose start


# Nginx proxies the ObjectStore from port 3333 to port 3334
cd ${NOVA_SRC_BASE}/debian
cp nova-objectstore.nginx.conf /etc/nginx/sites-enabled/
/etc/init.d/nginx restart


mkdir ${NOVA_SRC_BASE}/objects
cd ${NOVA_SRC_BASE}/objects

# Get a lucid (guest) image and register it as an image in our OpenStack cloud
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

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 


=== Playing with creating Volumes

# [ Add screen, switch to it ]
cd ${NOVA_SRC_BASE}

#ISCSI stuff (Highly experimental!!!)
# Based on this... http://cloudservers.rackspacecloud.com/index.php/Installing_Kernel_Headers_for_2.6.31-302-rs
cd ~/src
mkdir kernel-headers
cd kernel-headers
wget "http://kernel.slicehost.com/2.6.33.5-rscloud/patched_source/2.6.33.5-rscloud.tar.bz2"
tar jxf 2.6.33.5-rscloud.tar.bz2 
cd linux-2.6.33.5
cp /proc/config.gz .
gunzip config.gz
mv config .config
make modules_prepare
cd /usr/src
#ln -s linux-headers-2.6.33.5-rscloud linux
ln -s ~/src/kernel-headers/linux-2.6.33.5/include linux-headers-2.6.33.5-rscloud


mkdir iscsi
cd iscsi
wget "http://downloads.sourceforge.net/project/iscsitarget/iscsitarget/1.4.20.2/iscsitarget-1.4.20.2.tar.gz?use_mirror=superb-sea2&ts=1279294062"
tar zxf iscsitarget-1.4.20.2.tar.gz
cd iscsitarget-1.4.20.2
make KSRC=~/src/kernel-headers/linux-2.6.33.5/
make KSRC=~/src/kernel-headers/linux-2.6.33.5/ install

modprobe iscsi_trgt



echo "ISCSITARGET_ENABLE=true" > /etc/default/iscsitarget
/etc/init.d/iscsitarget start

# We need an iSCSI initiator; the packaged version doesn't support the cloud kernel (sigh...)
cd ~/src
#wget "http://www.open-iscsi.org/bits/open-iscsi-2.0-871.tar.gz"
#tar zxf open-iscsi-2.0-871.tar.gz
#cd open-iscsi-2.0-871.tar.gz

mkdir open-iscsi-git
apt-get install git
#git clone git://git.kernel.org/pub/scm/linux/kernel/git/mnc/linux-2.6-iscsi.git 
#cd linux-2.6-iscsi
#make KSRC=/root/src/kernel-headers/linux-2.6.33.5/
git clone git://git.kernel.org/pub/scm/linux/kernel/git/mnc/open-iscsi.git 
cd open-iscsi
make KSRC=/root/src/kernel-headers/linux-2.6.33.5/
make KSRC=/root/src/kernel-headers/linux-2.6.33.5/ install
cp /root/src/open-iscsi-git/open-iscsi/kernel/*.ko /lib/modules/`uname -r`/kernel/drivers/scsi


# This creates a 10GB file to create volumes out of
dd if=/dev/zero of=/volumes/fake.0 bs=128M count=80
LOOPBACK_MOUNT=`losetup --show -f /volumes/fake.0`

NOVA_VOLUME_ARGS="--storage_dev=${LOOPBACK_MOUNT}"
#bin/nova-volume ${NOVA_VOLUME_ARGS} --nodaemonize --verbose start
bin/nova-volume ${NOVA_VOLUME_ARGS} --nodaemonize --iscsi_storage=true --verbose start



euca-create-volume --size 1 -z nova

euca-describe-instances
euca-describe-volumes