Skip to content

Instantly share code, notes, and snippets.

@plu
Created September 23, 2012 06:34
Show Gist options
  • Save plu/3769105 to your computer and use it in GitHub Desktop.
Save plu/3769105 to your computer and use it in GitHub Desktop.

Install OpenStack on a Hetzner VQ7 server

Reinstall Ubuntu

  1. Boot the server into the 64bit Linux rescue system

  2. Run installimage

  3. Select Ubuntu 11.10 (oneiric) 64bit

  4. In the editor, where you have to set the disk partition sizes, search for following lines and remove them. The actual lines may vary if Hetzner changes anything.

     PART swap swap 2G
     PART /boot ext3 512M
     PART / ext4 all
    

Instead we want to use LVM:

    PART /boot ext2 512M
    PART lvm nova-volumes all
    LV nova-volumes root / ext4 4G
    LV nova-volumes swap swap swap 4G
    LV nova-volumes tmp /tmp ext4 8G
    LV nova-volumes var /var ext4 32G

The 32G on /var will be shared by running instances, MySQL, RabbitMQ and images. If that is not enough, it can be expanded later. The rest of the 1.5TB is left unused for nova-volume. 0. Once the server is back: apt-get update && apt-get upgrade

Install OpenStack

apt-get install rabbitmq-server iscsitarget iscsitarget-dkms mysql-server euca2ools unzip
sed -i 's/false/true/g' /etc/default/iscsitarget
service iscsitarget start
apt-get install nova-api nova-objectstore nova-compute nova-scheduler nova-network nova-volume glance

Create a new database in MySQL:

mysql -uroot -e 'create database nova'

Add following lines to /etc/nova/nova.conf:

--sql_connection=mysql://[email protected]/nova

Run the database migrations:

/usr/bin/nova-manage db sync

Restart the nova services:

for service in $(service --status-all 2>&1 | grep nova | awk '{print $4}'); do
  service $service restart;
done

Create a network:

nova-manage network create novanetwork 10.0.0.0/8 1 64 --bridge_interface=eth0

Create a user:

eval $(nova-manage user admin plu)

Create a project:

nova-manage project create plu-development plu

Create the zip file containing the keys:

nova-manage project zipfile plu-development plu

This file must be copied to the machine where euca2ools from will be used.

unzip nova.zip -d plu-development
source plu-development/novarc

Register an image

wget http://uec-images.ubuntu.com/releases/10.10/release/ubuntu-10.10-server-cloudimg-amd64.tar.gz
cloud-publish-tarball ubuntu-10.10-server-cloudimg-amd64.tar.gz plu-bucket

Create SSH keypair

euca-add-keypair plu1 > plu1.priv
chmod 600 plu1.priv

Run an instance

# find the name (e.g. ami-00000002)
euca-describe-images
euca-run-instances ami-00000002 -k plu1 -t m1.tiny

Once it's ready, it should look like this:

euca-describe-instances
RESERVATION	r-kk5ocnlt	plu-development	default
INSTANCE	i-00000001	ami-00000002	10.0.0.3	10.0.0.3	running	plu1 (plu-development, openstack)	0		m1.tiny	2012-02-04T08:52:45Z	nova	aki-00000001	ami-00000000

Connect to an instance

euca-authorize -P tcp -p 22 default
ssh -i plu1.priv [email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment