In this DevStack example, I will show how to install a DevStack-based demo OpenStack solution on an existing Ubuntu 14.04 server.
DevStack is an open source project with the goal to offer a development, test or demo environment for working with OpenStack. The compute nodes are based on QEMU, a software virtualization, so do not expect any high performance from this installation. However, it helps you to get acquainted with the handling of OpenStack, to get acquainted with OpenStack’s APIs and/or even to contribute to the OpenStack project.
In this post, we will install OpenStack on an existing Ubuntu server 14.04. I have tried to follow the official documentation, but it was easy to get lost there. The official documentation has led me to some challenges related to file permissions, which you can circumvent by following the step by step guide below.
- DevStack Example – Step by Step
- Step 1: Install Ubuntu 14.04 Server
- Step 2: Download DevStack from Git
- Step 3 (optional): take snapshot of your Ubuntu virtual machine (if it is a virtual machine)
- Step 4 (necessary?): copy and edit local.conf
- Step 5: create a non-root user called “stack” and log in as this user
- Step 6: copy the git repository to the “stack” user’s home directory
- Step 7: run the installation script
- Step 8: log in to Horizon as admin
- Step 9: explore Compute Nodes
- Step 10: create a virtual machine / Instance
- Appendix A: Workaround for Openstack Login Error “An error occurred authenticating Please try again later”
DevStack Example – Step by Step
Step 1: Install Ubuntu 14.04 Server
In my case, I have used Hyper-V and the Ubuntu Server 14.04 ISO for installing a high-performance Ubuntu server on my brand new monster Predator notebook with 64GB RAM. Hyper-V requires Windows 10 Pro license as a minimum if you are not working with Windows Server licenses. However, you can also choose to install Ubuntu 14.04.x on physical hardware, on VMware vSphere, VMware Workstation, the old VMware Server 2.0.2 or on VirtualBox.
Note: there is a nice and simple way to install Ubuntu on VirtualBox using Vagrant, which I have described in step 1 “Install a Docker Host” in this post. The Docker host Vagrant box is an Ubuntu 14.04 machine and the Docker software does not hurt. The biggest challenge there is to successfully install VirtualBox.
The following Software needs to be installed in addition on Ubuntu:
sudo apt-get install openssh-server git
Step 2: Download DevStack from Git
Now we need to download DevStack using git:
git clone https://git.openstack.org/openstack-dev/devstack/ cp devstack/samples/local.conf devstack/
Step 3 (optional): take snapshot of your Ubuntu virtual machine (if it is a virtual machine)
At this point, I have created a snapshot (checkpoint) of the VM on Hyper-V, so I can go back any time, the installation fails.
Step 4 (necessary?): copy and edit local.conf
In the moment, it is not clear, whether it is used during installation, but I have copied
devstack, as the official documentation always talks about changing
local.conf file :
cp devstack/samples/local.conf devstack/
And I have changed the content of devstack/local.conf like follows:
#local.conf ADMIN_PASSWORD=secret DATABASE_PASSWORD=$ADMIN_PASSWORD RABBIT_PASSWORD=$ADMIN_PASSWORD SERVICE_PASSWORD=$ADMIN_PASSWORD #... # OV: commented out # LOGFILE=$DEST/logs/stack.sh.log #... # OV: commented out #LOGDAYS=2 # I have kept following lines: SWIFT_HASH=66a3d6b56c1f479c8b4e70ab5c2000f5 SWIFT_REPLICAS=1 SWIFT_DATA_DIR=$DEST/data
Step 5: create a non-root user called “stack” and log in as this user
Devstack does not run as root, so we need a non-root user. You might want to re-use an existing non-root user instead, but I recommend to create it like follows:
myname@ubuntu:~$ sudo devstack/tools/create-stack-user.sh Creating a group called stack Creating a user called stack Giving stack user passwordless sudo privileges
The user stack has no password, so we only can log in via su as root. In my case, myname is a sudo user, so I have loged in via the command:
myname@ubuntu:~$ sudo su stack
Step 6: copy the git repository to the “stack” user’s home directory
This step is missing in the official documentation and had caused the installation script to fail due to wrong permissions. As user “stack”, navigate to the directory containing devstack and copy the directory to home directory:
cp -R devstack ~/
The devstack repository is not large, but if you do not want to copy it, you also could change the file permissions by using a
chown -R stack:stack devstack.
Step 7: run the installation script
Now the devstack folder and its contents are owned by user stack and the installation script should run with no problems:
cd ~/devstack; ./stack.sh
-> here I was asked for the password again, even though it is defined in local.conf already. I have not investigated yet, whether the Step 4 above is necessary at all. Just re-type the password you have defined in Step 4.
After ~50 minutes, we see following last message of the installation:
2016-06-21 09:44:20.771 | stack.sh completed in 2946 seconds.
In this case, the command was running on a Hyper-V Ubuntu 14.04.3 server with only one core of the i7-6700QM CPU and only 6 Mbps Internet download bandwidth.
Step 8: log in to Horizon as admin
Unfortunately, there is no information given on what to do next. Therefore, I have had a look into stack.sh and I have found that Horizon should be available on URL http://hostname/dashboard/auth/login/?next=/dashboard/ where hostname is 192.168.178.111 in my case:
Yes, perfect! Horizon is up and running.
Per trial and error, I have logged in as user “admin” with the password I have provided above and I have reached the Identity -> Projects screen:
Bingo! Time to play around!
Step 9: explore Compute Nodes
On Admin->Hypervisors, we can see that DevStack has added a single QEMU-based Hypervisor with 512MB RAM on the base ubuntu machine:
Step 10: create a virtual machine / Instance
On Projects->Compute->Instances, click on “Launch Instance”:
and then on “Next”. Then we can choose the image, from which the instance will be built:
Click on the Plus-sign next to the cirros image and click “Next”.
In the next screen, I have chosen the smallest flavor with 64MB RAM and no disk. Since the QEMU only provides 512MB, some of the other flavors should cause problems later on (can be tested later).
Let us skip the other steps for now and immediately create the instance by clicking “Launch Instance” at the bottom of the screen (you might need to scroll down). You immediately should see a green box flashing with a success message: First, there will be a task “Spawning”, which will change to “None” in a minute or so. At the same time, the instance Power state will be “Running”.
The instance is assigned a private IP address 10.0.0.2. However, is there a possibility to access the system?
Yes, from the Ubuntu system, you can ping the newly created instance:
stack@ubuntu:~$ ping 10.0.0.2 PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data. 64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=3.38 ms 64 bytes from 10.0.0.2: icmp_seq=2 ttl=64 time=0.333 ms
However, without SSH key, we will not be able to SSH into the system; similar to AWS instances.
In 25 minutes, the German team is playing soccer in the European Contest, so I will stop now with a final dashboard screen:
We have created and started a virtual machine (instance) on OpenStack.
Appendix A: Workaround for Openstack Login Error “An error occurred authenticating Please try again later”
After some days of OpenStack running with no interaction from my side, I could not log in to horizon anymore.
I have found this YouTube video with information on how to fix this issue. However, I could not find any shell script named
rejoin-stack.sh, as required. I have re-installed devstack instead. For that, I have issued following commands:
sudo su - stack cd ~/devstack ./unstack.sh sudo rm -rf /etc/keystone ./stack.sh
I had to remove the keystone folder with the
rm -rf command in order to avoid an
Operation not permitted failure during the execution of stack.sh. The downside of this solution is that it takes ~20 minutes of re-installation time again. At the end, I got following information:
This is your host IP address: 192.168.178.134 This is your host IPv6 address: ::1 Horizon is now available at http://192.168.178.134/dashboard Keystone is serving at http://192.168.178.134/identity/ The default users are: admin and demo The password: secret 2016-07-03 14:37:50.238 | WARNING: 2016-07-03 14:37:50.238 | Using lib/neutron-legacy is deprecated, and it will be removed in the future 2016-07-03 14:37:50.239 | stack.sh completed in 1082 seconds.
And I could log in again: