You are on page 1of 4

Running OpenStack under Virtual Box A Complete Guide (Part 1) Running OpenStack under virtual Box allows you

u to have a complete multi-node cluster that you can access and manage from the computer running Virtual Box as if youre accessing a region on Amazon. This is a complete guide to setting up a Virtual Box VM running Ubuntu, with OpenStack running on this guest and an OpenStack instance running, accessible from your host.
Part 1 OpenStack on a single virtual Box VM with OpenStack instances accessible from host

The environment used for this guide


A 64-Bit Intel Core i7 Laptop, 8Gb Ram. Ubuntu 10.10 Maverick AMD64 (The host) virtual Box 4 Access from host running virtual Box only (so useful for development/proof of concept)

The proposed environment


OpenStack Public Network: 172.241.0.0/25 OpenStack Private Network: 10.0.0.0/8 Host has access to its own LAN, separate to this on 192.168.0.0/16 and not used for this guide

The Guide

Download and install virtual Box from http://www.virtualbox.org/ Under Preferences Network Add/Edit Host-only network so you have vboxnet0. This will serve as the Public interface to your cloud environment o Configure this as follows Adapter IPv4 Address: 172.241.0.100 IPv4 Network Mask: 255.255.255.128 DHCP Server

Disable Server On your Linux host running VirtualBox, you will see an interface created called vboxnet0 with the address specified as 172.241.0.100. This will be the IP address your OpenStack instances will see when you access them.

o o

o o

o o

Create a new Guest Name: Cloud1 OS Type: Linux Version: Ubuntu (64-Bit) 1024Mb Ram Boot Hard Disk Dynamically Expanding Storage 8.0Gb After this initial set up, continue to configure the guest Storage: Edit the CD-ROM so that it boots Ubuntu 10.10 Live or Server ISO Ensure that the SATA controller has Host I/O Cache Enabled (recommended by VirtualBox for EXT4 filesystems) Network: Adapter 1 Host-only Adapter Name: vboxnet0 Adapter 2 NAT This will provide the default route to allow the VM to access the internet to get the updates, OpenStack scripts and software Audio: Disable (just not required) Power the guest on and install Ubuntu For this guide Ive statically assigned the guest with the IP: 172.241.0.101 for eth0 and netmask 255.255.255.128. This will be the IP address that you will use to access the guest from your host box, as well as the IP address you can use to SSH/SCP files around. Once installed, run an update (sudo apt-get update&&sudo apt-get upgrade) then reboot If youre running a desktop, install the Guest Additions (Device Install Guest Additions, then click on Places and select the VBoxGuestAdditions CD and follow the Autorun script), then Reboot Install openssh-server
sudo apt-get -y install openssh-server

Grab this script to install OpenStack This will set up a repository (ppa:nova/trunk) and install MySQL server where the information regarding your cloud will be stored The options specified on the command line match the environment described above

wget https://github.com/uksysadmin/OpenStackInstaller/raw/master /OSinstall.sh sudo bash ./OSinstall.sh -A $(whoami) ADMIN=$(whoami) sudo nova-manage user admin ${ADMIN} sudo nova-manage role add ${ADMIN} cloudadmin sudo nova-manage project create myproject ${ADMIN} sudo nova-manage project zipfile myproject ${ADMIN} mkdir -p cloud/creds cd cloud/creds unzip ~/nova.zip . novarc cd euca-add-keypair openstack > ~/cloud/creds/openstack.pem chmod 0600 cloud/creds/*

o o

Run the script (as root/through sudo)


Run the post-configuration steps

Congratulations, you now have a working Cloud environment waiting for its first image and instances to run, with a user you specified on the command line (yourusername), the credentials to access the cloud and a project called myproject to host the instances.
o

You now need to ensure that you can access any instances that you launch via SSH as a minimum (as well as being able to ping) but I add in access to a web service and port 8080 too for this environment as my default security group.
euca-authorize euca-authorize euca-authorize euca-authorize default default default default -P -P -P -P tcp -p 22 -s 0.0.0.0/0 tcp -p 80 -s 0.0.0.0/0 tcp -p 8080 -s 0.0.0.0/0 icmp -t -1:-1

Next you need to load a UEC image into your cloud so that instances can be launched from it
image="ttylinux-uec-amd64-12.1_2.6.35-22_1.tar.gz" wget http://smoser.brickies.net/ubuntu/ttylinux-uec/$image uec-publish-tarball $image mybucket

Once the uec-publish-tarball command has been run, it will present you with a line with emi=, eri= and eki= specifying the Image, Ramdisk and Kernel as shown below. Highlight this, copy and paste back in your shell
Thu Feb 24 09:55:19 GMT 2011: ====== extracting image ====== kernel : ttylinux-uec-amd64-12.1_2.6.35-22_1-vmlinuz ramdisk: ttylinux-uec-amd64-12.1_2.6.35-22_1-initrd image : ttylinux-uec-amd64-12.1_2.6.35-22_1.img Thu Feb 24 09:55:19 GMT 2011: ====== bundle/upload kernel ====== Thu Feb 24 09:55:21 GMT 2011: ====== bundle/upload ramdisk ====== Thu Feb 24 09:55:22 GMT 2011: ====== bundle/upload image ====== Thu Feb 24 09:55:25 GMT 2011: ====== done ====== emi="ami-fnlidlmq"; eri="ami-dqliu15n"; eki="ami-66rz6vbs";

o o o o o o o o

o o

To launch an instance
euca-run-instances $emi -k openstack -t m1.tiny euca-describe-instances

To check its running

You will see the Private IP that has been assigned to this instance, for example 10.0.0.3 To access this via SSH (To log out of ttylinux, type: logout) Congratulations, you now have an OpenStack instance running under OpenStack Nova, running under a VirtualBox VM! To access this outside of the VirtualBox environment (i.e. back on your real computer, the host) you need to assign it a public IP Associate this to the instance id (get from euca-describe-instances and will be of the format i-00000000)
euca-allocate-address This will return an IP address that has been assigned to your project so ssh -i cloud/creds/openstack.pem root@10.0.0.3

o o

that you can now associate to your instance, e.g. 172.241.0.3


euca-associate-address -i i-00000001 172.241.0.3

Now back on your host (so outside of VirtualBox), grab a copy of cloud/creds directory
scp -r user@172.241.0.101:cloud/creds .

You can now access that host using the Public address you associated to it above
ssh -i cloud/creds/openstack.pem root@172.241.0.3

CONGRATULATIONS! You have now created a complete cloud environment under VirtualBox that you can manage from your computer (host) as if youre managing services on Amazon. To demonstrate this you can terminate that instance you created from your computer (host)
o o o o sudo apt-get install euca2ools . cloud/creds/novarc euca-describe-instances euca-terminate-instances i-00000001

You might also like