Home / Openstack / How to Deploy Openstack on Ubuntu ?

How to Deploy Openstack on Ubuntu ?

Deploying openstack on Ubuntu is very easy if you use the devstack method. DevStack is not general openstack installer but it will help us to reduce the manual configuration for first time deployment. Let’s follow the easiest method to understand the openstack deployment and other functionality. Here I have chosen Ubuntu  as my base operating system/Hyper-visor. Why I should choose Ubuntu ?  Ubuntu is Debian Linux  variant operating system and it is one of the stable Linux operating system in the world. Ubuntu’s simple package management and supports impressed me lot. Also Ubuntu is the world’s most popular operating system for OpenStack and widely used on many public and private clouds.

Let’s start.

Prerequisites:

  • X86 Server Hardware with VT enabled. (You can also use VM for testing purpose)
  • Two NIC’s
  • 2 x 30GB HDD
  • 8GB Memory
  • 2 CPU cores
  • Internet Connectivity to Host.

Deploying Openstack on Ubuntu 14.04:

1. Install the latest Ubuntu OS on base hardware . If you want to play with openstack , then just install the Ubuntu on VMware workstation as guest operating system.

2. Login to Ubuntu 14.04 and Install git package.

root@uacloud:~# apt-get install -y git
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  git-man liberror-perl
Suggested packages:
  git-daemon-run git-daemon-sysvinit git-doc git-el git-email git-gui gitk
  gitweb git-arch git-bzr git-cvs git-mediawiki git-svn
The following NEW packages will be installed:
  git git-man liberror-perl
0 upgraded, 3 newly installed, 0 to remove and 11 not upgraded.
Need to get 3,346 kB of archives.
After this operation, 21.6 MB of additional disk space will be used.
Get:1 http://in.archive.ubuntu.com/ubuntu/ trusty/main liberror-perl all 0.17-1.1 [21.1 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu/ trusty-updates/main git-man all 1:1.9.1-1ubuntu0.1 [698 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu/ trusty-updates/main git amd64 1:1.9.1-1ubuntu0.1 [2,627 kB]
Fetched 3,346 kB in 13s (254 kB/s)
Selecting previously unselected package liberror-perl.
(Reading database ... 56497 files and directories currently installed.)
Preparing to unpack .../liberror-perl_0.17-1.1_all.deb ...
Unpacking liberror-perl (0.17-1.1) ...
Selecting previously unselected package git-man.
Preparing to unpack .../git-man_1%3a1.9.1-1ubuntu0.1_all.deb ...
Unpacking git-man (1:1.9.1-1ubuntu0.1) ...
Selecting previously unselected package git.
Preparing to unpack .../git_1%3a1.9.1-1ubuntu0.1_amd64.deb ...
Unpacking git (1:1.9.1-1ubuntu0.1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up liberror-perl (0.17-1.1) ...
Setting up git-man (1:1.9.1-1ubuntu0.1) ...
Setting up git (1:1.9.1-1ubuntu0.1) ...
root@uacloud:~#

3. Create user and group called “stack” and  set the password for the user.  (Do not try with other username).

root@uacloud:~# groupadd stack
root@uacloud:~# useradd -g stack -s /bin/bash -d /opt/stack -m stack
root@uacloud:~# passwd stack
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
root@uacloud:~#

4. Provide the password less sudo access to the user “stack”.

root@uacloud:~# echo "stack ALL=(ALL)  NOPASSWD:ALL " >> /etc/sudoers
root@uacloud:~# cat /etc/sudoers |grep stack
stack ALL=(ALL)  NOPASSWD:ALL
root@uacloud:~#

5. System must has static IP. Make sure that /etc/hosts file has the FQDN for the host.

root@uacloud:~# cat /etc/network/interfaces |tail
iface eth0 inet static
        address 192.168.203.160
        netmask 255.255.255.0
        gateway 192.168.203.2
uacloud:~#getent hosts |grep uacloud
127.0.1.1       uacloud
192.168.203.160 uacloud uacloud.ua.com
uacloud:~#

6. Logout and login as “stack” user.

uacloud:~$id
uid=1001(stack) gid=1001(stack) groups=1001(stack)

7. Configure the password less authentication for stack user with the same host.

uacloud:~$ssh stack@uacloud
The authenticity of host 'uacloud (127.0.1.1)' can't be established.
ECDSA key fingerprint is 8e:c1:20:29:32:b4:67:5c:fb:b2:a0:8c:3a:ee:9a:85.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'uacloud' (ECDSA) to the list of known hosts.
stack@uacloud's password:
uacloud:~$

Asking for the password ? . Let me generate the new RSA keys for user “stack” and make it as password less authentication.

uacloud:~$cd ~stack/.ssh
uacloud:~$ls -la
total 12
drwx------ 2 stack stack 4096 Aug 19 01:11 .
drwxr-xr-x 4 stack stack 4096 Aug 19 01:10 ..
-rw-r--r-- 1 stack stack  222 Aug 19 01:11 known_hosts
uacloud:~$ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/opt/stack/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /opt/stack/.ssh/id_rsa.
Your public key has been saved in /opt/stack/.ssh/id_rsa.pub.
The key fingerprint is:
df:0d:92:bc:3f:e8:5c:25:33:1e:e4:d3:a4:99:b8:54 stack@uacloud
The key's randomart image is:
+---[RSA 2048]----+
|                 |
|                 |
|            E .  |
|         . * *   |
|        S * % o  |
|         o * X   |
|          +.+ .  |
|         ..o.    |
|         .o ..   |
+-----------------+
uacloud:~$

Copy the id_rsa.pub as authorized_keys in the user home directory.

uacloud:~$ls -la
total 20
drwx------ 2 stack stack 4096 Aug 19 01:14 .
drwxr-xr-x 4 stack stack 4096 Aug 19 01:10 ..
-rw------- 1 stack stack 1675 Aug 19 01:14 id_rsa
-rw-r--r-- 1 stack stack  395 Aug 19 01:14 id_rsa.pub
-rw-r--r-- 1 stack stack  222 Aug 19 01:11 known_hosts
uacloud:~$cp id_rsa.pub authorized_keys
uacloud:~$
uacloud:~$chmod 400 authorized_keys id_rsa.pub
uacloud:~$ls -lrt
total 16
-rw-r--r-- 1 stack stack  222 Aug 19 01:11 known_hosts
-r-------- 1 stack stack  395 Aug 19 01:14 id_rsa.pub
-rw------- 1 stack stack 1675 Aug 19 01:14 id_rsa
-r-------- 1 stack stack  395 Aug 19 01:14 authorized_keys
uacloud:~$

Let me test it.

stack@uacloud:~/devstack$ ssh stack@uacloud
Welcome to Ubuntu 14.04.3 LTS (GNU/Linux 3.19.0-25-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Thu Aug 20 06:56:57 IST 2015

  System load:  0.63               Processes:             236
  Usage of /:   12.4% of 25.47GB   Users logged in:       0
  Memory usage: 63%                IP address for eth0:   192.168.203.160
  Swap usage:   0%                 IP address for virbr0: 192.168.122.1

  Graph this data and manage this system at:
    https://landscape.canonical.com/

10 packages can be updated.
10 updates are security updates.

Last login: Thu Aug 20 06:57:19 2015 from 192.168.203.1
stack@uacloud:~$

It works.

8. Clone the Openstack package from github to stack user’s  home directory .

uacloud:~$cd ~
uacloud:~$pwd
/opt/stack
uacloud:~$git clone https://github.com/openstack-dev/devstack
Cloning into 'devstack'...
remote: Counting objects: 28833, done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 28833 (delta 2), reused 0 (delta 0), pack-reused 28826
Receiving objects: 100% (28833/28833), 9.97 MiB | 212.00 KiB/s, done.
Resolving deltas: 100% (20001/20001), done.
Checking connectivity... done.
uacloud:~$

9.  Navigate to the “devstack” directory which is created under the stack user home .

uacloud:~$cd devstack/
uacloud:~$ls -lrt
total 316
-rw-rw-r-- 1 stack stack 15716 Aug 19 01:19 README.md
-rw-rw-r-- 1 stack stack  2591 Aug 19 01:19 Makefile
-rw-rw-r-- 1 stack stack  1506 Aug 19 01:19 MAINTAINERS.rst
-rw-rw-r-- 1 stack stack 10143 Aug 19 01:19 LICENSE
-rw-rw-r-- 1 stack stack 14945 Aug 19 01:19 HACKING.rst
-rw-rw-r-- 1 stack stack  3774 Aug 19 01:19 FUTURE.rst
-rwxrwxr-x 1 stack stack  1978 Aug 19 01:19 exercise.sh
-rw-rw-r-- 1 stack stack  1145 Aug 19 01:19 exerciserc
-rw-rw-r-- 1 stack stack  1547 Aug 19 01:19 eucarc
drwxrwxr-x 2 stack stack  4096 Aug 19 01:19 driver_certs
drwxrwxr-x 3 stack stack  4096 Aug 19 01:19 doc
-rwxrwxr-x 1 stack stack  3229 Aug 19 01:19 clean.sh
drwxrwxr-x 2 stack stack  4096 Aug 19 01:19 extras.d
drwxrwxr-x 2 stack stack  4096 Aug 19 01:19 exercises
drwxrwxr-x 2 stack stack  4096 Aug 19 01:19 gate
-rw-rw-r-- 1 stack stack 64721 Aug 19 01:19 functions-common
-rw-rw-r-- 1 stack stack 23567 Aug 19 01:19 functions
drwxrwxr-x 7 stack stack  4096 Aug 19 01:19 files
drwxrwxr-x 2 stack stack  4096 Aug 19 01:19 inc
-rwxrwxr-x 1 stack stack 41570 Aug 19 01:19 stack.sh
-rw-rw-r-- 1 stack stack 30952 Aug 19 01:19 stackrc
-rwxrwxr-x 1 stack stack   781 Aug 19 01:19 setup.py
-rw-rw-r-- 1 stack stack   456 Aug 19 01:19 setup.cfg
drwxrwxr-x 2 stack stack  4096 Aug 19 01:19 samples
-rwxrwxr-x 1 stack stack  1188 Aug 19 01:19 run_tests.sh
-rwxrwxr-x 1 stack stack   638 Aug 19 01:19 rejoin-stack.sh
drwxrwxr-x 2 stack stack  4096 Aug 19 01:19 pkg
-rw-rw-r-- 1 stack stack  3984 Aug 19 01:19 openrc
drwxrwxr-x 8 stack stack  4096 Aug 19 01:19 lib
drwxrwxr-x 5 stack stack  4096 Aug 19 01:19 tools
drwxrwxr-x 2 stack stack  4096 Aug 19 01:19 tests
-rwxrwxr-x 1 stack stack  4185 Aug 19 01:19 unstack.sh
-rw-rw-r-- 1 stack stack  1445 Aug 19 01:19 tox.ini
uacloud:~$

10.  Check the current branch and change it to “juno” openstack branch . kilo is the most recent stable release but still it has some bugs.

uacloud:~$git branch
* master
uacloud:~$git checkout stable/juno
Branch stable/juno set up to track remote branch stable/juno from origin.
Switched to a new branch 'stable/juno'
uacloud:~$git branch
  master
* stable/juno
uacloud:~$

11. Create the installation file like below.

uacloud:~$cat local.conf
[[local|localrc]]
# IP address of the Machine (Ubuntu)
HOST_IP=192.168.203.160
# Specify the ethernet card you are exposing to openstack
FLAT_INTERFACE=eth0
# Specify a Private IP Range - should be a non-existing network
FIXED_RANGE=192.168.204.0/24
FIXED_NETWORK_SIZE=256

# Specify a FLOATING/ELASTIC IP RANGE a existing network.
FLOATING_RANGE=192.168.203.128/24

MULTI_HOST=1

# Log File Destination
LOGFILE=/opt/stack/logs/stack.sh.log

#Set Password for services , rabbitMQ,Database etc
ADMIN_PASSWORD=uapwd123
DATABASE_PASSWORD=uapwd123
MYSQL_PASSWORD=uapwd123
RABBIT_PASSWORD=uapwd123
SERVICE_PASSWORD=uapwd123
SERVICE_TOKEN=ADMIN
RECLONE=yes

uacloud:~$

Change the IP information according to your network. Read the comments within the file carefully.
It is better to keep same password for all the services for first time deployment.

12. Switch to root user and enable the IP forwarding .

uacloud:~$sudo su -
root@uacloud:~# echo  1 > /proc/sys/net/ipv4/ip_forward
root@uacloud:~# echo 1 > /proc/sys/net/ipv4/conf/eth0/proxy_arp
root@uacloud:~# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

The ip_forward and proxy_arp changes will be reset when the machice reboots. You can make these changes permanent by editing /etc/sysctl.conf and adding the following lines

root@uacloud:~# grep -v "#" /etc/sysctl.conf
net.ipv4.conf.eth0.proxy_arp = 1
net.ipv4.ip_forward = 1
root@uacloud:~# exit

 

13. Login back as stack user & Run stack.sh to start deploying the openstack. It will take minimum 30 to 40 mins depends on the internet connection speed.

stack@uacloud:~/devstack$ ./stack.sh
2015-08-19 18:58:15.517 | ++ trueorfalse False
2015-08-19 18:58:15.523 | + OFFLINE=False
2015-08-19 18:58:15.523 | ++ trueorfalse False
2015-08-19 18:58:15.526 | + ERROR_ON_CLONE=False
2015-08-19 18:58:15.527 | ++ trueorfalse True
2015-08-19 18:58:15.530 | + ENABLE_DEBUG_LOG_LEVEL=True
2015-08-19 18:58:15.531 | + FLOATING_RANGE=192.168.203.170/24
2015-08-19 18:58:15.531 | + FIXED_RANGE=192.168.204.0/24
2015-08-19 18:58:15.531 | + FIXED_NETWORK_SIZE=256

<<<<==================some of the console logs removed=============================>>>

Horizon is now available at http://192.168.203.160/
Keystone is serving at http://192.168.203.160:5000/v2.0/
Examples on using novaclient command line is in exercise.sh
The default users are: admin and demo
The password: uapwd123
This is your host ip: 192.168.203.160
stack@uacloud:~/devstack$

In the bottom of the script output, you will get the Dashboard – Horizon Details and credentials .

To see the complete logs , Openstack installation logs.

 

14. Lanuch the Openstack Dashboard using the IP address or hostname .

Dashboard - Horizon
Dashboard – Horizon

 

Great. We got the Openstack Dashboard.  In the upcoming articles , we will see how we can use the dashboard to launch the instances.  Stay tuned with UnixArena by following in UnixArena Fans pages .

 

If the stack.sh failed with unknown errors , you must review the few things here.

 

1.Make sure Ubuntu version is on 14.04 .

Ubuntu 14.04.3 LTS (GNU/Linux 3.19.0-25-generic x86_64)

 

2. Openstack git branch should be on juno.

stack@uacloud:~/devstack$ git checkout stable/juno
Switched to branch 'stable/juno'
Your branch is up-to-date with 'origin/stable/juno'.
stack@uacloud:~/devstack$

 

3. In local.conf , RECLONE=yes

stack@uacloud:~/devstack$ grep RECLONE local.conf
RECLONE=yes
stack@uacloud:~/devstack$ pwd
/opt/stack/devstack
stack@uacloud:~/devstack$

Reclone is used to keep the release up to date.   For production  environment, reclone should be set as “no”.

 

  • If the above things are not correct, you will get errors like below.

2015-08-19 18:41:16.661 | module = __import__(self.module_name, fromlist=[‘__name__’], level=0)
2015-08-19 18:41:16.662 | ImportError: No module named setuptools_ext
2015-08-19 18:41:16.662 |
2015-08-19 18:41:16.662 | —————————————-
2015-08-19 18:41:16.662 | Failed building wheel for cryptography
2015-08-19 18:41:16.662 | Running setup.py bdist_wheel for pyasn1
2015-08-19 18:41:16.857 | Stored in directory: /opt/stack/.wheelhouse
2015-08-19 18:41:16.858 | Running setup.py bdist_wheel for enum34
2015-08-19 18:41:17.006 | Stored in directory: /opt/stack/.wheelhouse
2015-08-19 18:41:17.006 | Running setup.py bdist_wheel for cffi
2015-08-19 18:41:19.851 | Stored in directory: /opt/stack/.wheelhouse
2015-08-19 18:41:19.851 | Successfully built pyasn1 enum34 cffi
2015-08-19 18:41:19.852 | Failed to build cryptography
2015-08-19 18:41:19.871 | ERROR: Failed to build one or more wheels
2015-08-19 18:41:19.903 | +++ err_trap
2015-08-19 18:41:19.903 | +++ local r=1
2015-08-19 18:41:19.918 | Error on exit
stack@uacloud:~/devstack$

 

  • If the Ubuntu version is 15.04, you will get error like below,

stack@CGI-MVPN:~/devstack$ ./stack.sh
WARNING: this script has not been tested on vivid
[Call Trace] ./stack.sh:98:die
[ERROR] ./stack.sh:98 If you wish to run this script anyway run with FORCE=yes
stack@CGI-MVPN:~/devstack$

  • You can overwrite above error by running like this , but stack.sh will failed at last. So better to use Ubuntu 14.04 which is already tested by devstack community.

stack@uacloud:~/devstack$ FORCE=yes ./stack.sh
WARNING: this script has not been tested on vivid
2015-08-19 07:44:11.024 | + uname -a
2015-08-19 07:44:11.024 | Linux uacloud 3.19.0-15-generic #15-Ubuntu SMP Thu Apr 16 23:32:37 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
2015-08-19 07:44:11.024 | + SSL_BUNDLE_FILE=/opt/stack/data/ca-bundle.pem

 

  • Stack.sh will also fails in situation where your internet speed is not good or intermediate disconnects.

 

Hope this article is informative to you .

Share it ! Support Openstack !! Now we are almost in Opensource world.

VMTURBO-CLOUD-CAPACITY

One comment

  1. Hi

    I know this is a very old post but I am new to openstack world. Trying to deploy this using liberty branch on the Ubutu virtual machine running in vmware workstation 10. My setup fails with the setting for fixed/floating ip.

    Could you please let me know what configuration you used for the NICs the VM. I have 1 Nic (eth0) bridged (192.168.0.0/24 network)

    My local.conf file setting was

    HOST_IP=192.168.0.15
    FLAT_INTERFACE=eth0
    FIXED_RANGE=192.168.204.0/24
    FIXED_NETWORK_SIZE=256
    FLOATING_RANGE=192.168.0.100/24

    Thanks
    Barun

Leave a Reply

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