Openstack on Ubuntu 12.04 LTS

Home » Computer Articles » Linux » Openstack on Ubuntu 12.04 LTS
April 3, 2013 Linux No Comments

I've been wanting to try out Openstack for a while and I finally made the time to do a test setup. Now there is a Devstack setup which was really easy to setup but I wanted to do a full production setup. So here are the steps I took. Of course I haven't added all the information here. I do have a reference section where you can get a lot more information.

 

Download the current Ubuntu 12.04 LTS, Click here to download.

 

Setting up your server.

 

Make sure system is up to date.

# apt-get update && apt-get upgrade

 

Install Openssh and lvm2

# apt-get install openssh-client openssh-server lvm2

 

Install time service.

# apt-get install ntp

Edit the /etc/ntp.conf and information below.

driftfile /var/lib/ntp/ntp.drift

server ntp.ubuntu.com iburst
server 127.127.1.0
fudge 127.127.1.0 stratum 10

 

Install some utilities for Iscsi needed for nova-volume.

# apt-get install tgt open-iscsi open-iscsi-utils

 

Need to add hard drive for Nova volume.

# fdisk /dev/sdb

# pvcreate -ff /dev/sdb1

# vgcreate nova-volumes /dev/sdb1

Eanble ip_forward

# vi /etc/sysctl.conf

 uncomment net.ipv4.ip_forward=1

# sysctl -p (This will load the sysctl.conf file)


Network setup. Edit the /etc/network/interfaces

auto eth0
iface eth0 inet static
address 192.168.1.220
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4

auto eth1
iface eth1 inet static
address 10.10.0.10
network 10.10.0.0
netmask 255.255.255.0
broadcast 10.10.0.255

 

Make sure you have the bridge Utils package installed.

# apt-get install bridge-utils

 

Restart your network.

# /etc/init.d/networking restart

 

More software that is needed.

# apt-get install rabbitmq-server memcached python-memcache kvm libvirt-bin mysql-server python-mysqldb

When installing libvirt it creates a default nat interface which I wanted removed.

# virsh net-destroy default
# virsh net-undefine default

 

When installing MySQL it asked for a password, which I setup. You will need this later.

 

Edit the MySQL vi /etc/mysql/my.cnf file and make this change.

bind-address = 127.0.0.1

bind-address = 0.0.0.0

Restart MySQL

# service mysql restart

 

You will need to setup some databases and users.

mysql -u root -p (Enter password)
CREATE DATABASE nova;
GRANT ALL PRIVILEGES ON nova.* TO 'novadbadmin'@'%' IDENTIFIED BY 'password';

CREATE DATABASE glance;
GRANT ALL PRIVILEGES ON glance.* TO 'glancedbadmin'@'%' IDENTIFIED BY 'password';

CREATE DATABASE keystone;
GRANT ALL PRIVILEGES ON keystone.* TO 'keystonedbadmin'@'%' IDENTIFIED BY 'password';

FLUSH PRIVILEGES;
quit

 

 Installing and configuring Keystone.

# apt-get install keystone python-keystone python-mysqldb python-keystoneclient

 

Edit /etc/keystone/keystone.conf and change sql connection type to

connection = mysql://keystonedbadmin:[email protected]/keystone

 

 Restart the keystone service.

# service keystone restart

 

Lets create some tables for keystone.

# keystone-manage db_sync

 

Now we need some data in the database.

# wget http://www.hastexo.com/system/files/user/4/keystone_data.sh__0.txt

# wget http://www.hastexo.com/system/files/user/4/endpoints.sh__0.txt

# mv keystone_data.sh__0.txt keystone_data.sh

# mv endpoints.sh__0.txt endpoints.sh

 

Lets make these scripts executable.

# chmod + keystone_data.sh endpoints.sh

 

Edit the keystone_data.sh and change the entry below. This will be the password you set early.

ADMIN_PASSWORD=${ADMIN_PASSWORD:-password}
export SERVICE_TOKEN="ADMIN"

 

Now lets run the keystone_data.sh script.

# ./keystone_data.sh (If everything is OK, the script will end without errors.)

 

Now you need to configure some endpoints.

# ./endpoints.sh -m 192.168.1.220 -u keystonedbadmin -D keystone -p password -K 192.168.1.220 -R RegionOne -E "http://localhost:35357/v2.0" -S 192.168.1.220 -T ADMIN

 

Installing and configuring Glance

# apt-get install glance glance-api glance-client glance-common glance-registry python-glance

 

Edit /etc/glance/glance-api-paste.ini and change below.

admin_tenant_name = service
admin_user = glance
admin_password = password

 

Edit /etc/glance/glance-registry-paste.ini and change below.

admin_tenant_name = service
admin_user = glance
admin_password = password

Next lets edit /etc/glance/glance-registry.conf

Look for sql_connection entry and replace with below.

sql_connection = mysql://glancedbadmin:[email protected]/glance  

 

At the end of this file add

[paste_deploy]
flavor = keystone


At the end of this file /etc/glance/glance-api.conf add

[paste_deploy]
flavor = keystone

 

Afterwards, you need to initially synchronize the Glance database by running these commands:
# glance-manage version_control 0
# glance-manage db_sync

Restart Glance:
# service glance-api restart && service glance-registry restart


We'll be using a Ubuntu UEC image for this. Download one:

# wget http://uec-images.ubuntu.com/releases/12.04/release/
ubuntu-12.04-server-cloudimg-amd64-disk1.img

 

 
Then add this image to Glance:
# glance add name="Ubuntu 12.04 cloudimg amd64" is_public=true container_format=ovf
 disk_format=qcow2 < ubuntu-12.04-server-cloudimg-amd64-disk1.img
After this, if you do
# glance index
Installing and configuring Nova.
# apt-get install nova-api nova-cert nova-common nova-compute nova-compute-kvm nova-doc nova-network nova-objectstore nova-scheduler nova-volume nova-consoleauth novnc python-nova python-novaclient
Edit /etc/nova/nova.conf and replace everything with the information below.

--dhcpbridge_flagfile=/etc/nova/nova.conf
--dhcpbridge=/usr/bin/nova-dhcpbridge
--logdir=/var/log/nova
--state_path=/var/lib/nova
--lock_path=/var/lock/nova
--allow_admin_api=true
--use_deprecated_auth=false
--auth_strategy=keystone
--scheduler_driver=nova.scheduler.simple.SimpleScheduler
--s3_host=192.168.1.220
--ec2_host=192.168.1.220
--rabbit_host=192.168.1.220
--cc_host=192.168.1.220
--nova_url=http://192.168.1.220:8774/v1.1/
--routing_source_ip=192.168.1.220
--glance_api_servers=192.168.1.220:9292
--image_service=nova.image.glance.GlanceImageService
--iscsi_ip_prefix=192.168.22
--sql_connection=mysql://novadbadmin:password@192.168.1.220/nova
--ec2_url=http://192.168.1.220:8773/services/Cloud
--keystone_ec2_url=http://192.168.1.220:5000/v2.0/ec2tokens
--api_paste_config=/etc/nova/api-paste.ini
--libvirt_type=kvm
--libvirt_use_virtio_for_bridges=true
--start_guests_on_host_boot=true
--resume_guests_state_on_host_boot=true
--vnc_enabled=true
--vncproxy_url=http://192.168.1.220:6080
--vnc_console_proxy_url=http://192.168.1.220:6080
# network specific settings
--network_manager=nova.network.manager.FlatDHCPManager
--public_interface=eth0
--flat_interface=eth1
--flat_network_bridge=br100
--fixed_range=10.10.0.100/27
--floating_range=192.168.1.224/27
--network_size=32
--flat_network_dhcp_start=10.10.0.10
--flat_injected=False
--force_dhcp_release
--iscsi_helper=tgtadm
--connection_type=libvirt
--root_helper=sudo nova-rootwrap
--verbose
--libvirt_use_virtio_for_bridges
--ec2_private_dns_show
--novnc_enabled=true
--novncproxy_base_url=http://192.168.1.220:6080/vnc_auto.html
--vncserver_proxyclient_address=192.168.1.220
--vncserver_listen=192.168.1.220

Edit /etc/nova/api-paste.ini

admin_tenant_name = service
admin_user = nova
admin_password = password

Stop and start Nova service.
Stop:
# for a in libvirt-bin nova-network nova-compute nova-cert nova-api nova-objectstore
 nova-scheduler nova-volume novnc nova-consoleauth; do service "$a" stop; done
Start:
# for a in libvirt-bin nova-network nova-compute nova-cert nova-api nova-objectstore
 nova-scheduler nova-volume novnc nova-consoleauth; do service "$a" start; done
List currently running VM's
# nova list
List of current VM images.
# nova image-list
You should see the image we uploaded before.
Install the Openstack Dashboard.
# apt-get install apache2 libapache2-mod-wsgi openstack-dashboard
You should now be able to connect with a web browser to your Openstack Dashboard.
http://192.168.1.220
I have some work to do here as not everything is working.
References:
Installing Openstack on Ubuntu in 10 minutes, http://www.stackgeek.com/guides/gettingstarted.html
Share This:

Leave a Reply

Your email address will not be published. Required fields are marked *