This guide will help you install OpenStack on CentOS 7. If you would like to install Openstack on Ubuntu, here is a guide to install OpenStack on a single Ubuntu 14.04 server, and this one will help you get OpenStack installed on a single Ubuntu 16.04 server.
I’ve always been rather curious about OpenStack and what it can and can’t do. I’ve been mingling with various virtualization platforms for many, many years. Most of my production level experience has been with VMWare but I’ve definitely seen the tremendous value and possibilities the OpenStack platform has to offer. A few days ago I came across DevStack while reading up on what it takes to get an OpenStack environment set up. DevStack is pretty awesome. Its basically a powerful script that was created to make installing OpenStack stupid easy, on a single server, for testing and development. You can install DevStack on a physical server (which I will be doing), or even a VM (virtual machine). Obviously, this is nothing remotely resembling a production ready deployment of OpenStack, but, if you want a quick and dirty environment to get your feet wet, or do some development work, this is absolutely the way to go.
The process to get DevStack up and running goes like this:
- Pick a Linux distribution and install it. I’m using CentOS7.
- Download DevStack and do a basic configuration.
- Kick of the install and grab a cup of coffee.
A few minutes later you will have a ready-to-go OpenStack infrastructure to play with.
Server Setup and Specs
I have always been fond of CentOS and it is always my go-to OS of choice for servers, so that is what I’m going to use here. CentOS version 7 to be exact. Just so you know, DevStack works on Ubuntu 14.04 (Trusty), Fedora 20, and CentOS/RHEL 7. The setup is pretty much the same for all three so if you’re using one of the other supported OS’s, you should be able to follow along without issues, but YMMV.
I have a modest little 1u “micro server” I built a while back and that is what I’m installing DevStack/OpenStack on today. The specs aren’t anything to write home about but they should be more than sufficient for this scenario. Here’s what’s inside:
- Athena Power RM-1U102ITX 1u Mini-ITX Rackmount Server Case
- Intel DH77DF Mini-ITX Motherboard
- Intel Core i5-2400S 2.5GHz / 3.30 Ghz Turbo CPU
- 8GB (2x4GB) Crucial DDR3 1333MHz RAM
- 160GB Intel SSD 320 Series 1.8″ Solid State Disk
- 250GB Western Digital 7200RPM 2.5 Hard Drive
The first thing we need to do is install an operating system on the server or provision one if you’re using a VM. You will want to have a freshly installed CentOS 7 x64 minimal OS. The only package you might want to select during installation is OpenSSH so you can connect remotely. I’m going to assume you already have CentOS 7 downloaded and know how to install. If not, here are some links for you:
Lets Get Started
So, now we are at a command prompt on our fresh server installation. I assume you already have an IP address configured as well as a host name. The first thing I recommend doing is a yum update (or, if you’re using Ubuntu, an apt-get upgrade)
[root@stack ~]# yum update -y
Now, we will install git and use it to download DevStack. The devstack repo includes a script that will install OpenStack as well as templates for the configuration files. So, go ahead and do the following:
[root@stack tmp]# cd /tmp [root@stack tmp]# yum install git -y [root@stack tmp]# git clone https://git.openstack.org/openstack-dev/devstack
Easy so far, right? Next, lets configure DevStack. The script that is going to do all the magic and set everything up for us is called stack.sh. It will run without a localrc section in local.conf but from what I’ve read life will be much easier if there are a few variables set. It is recommended that at least a minimal configuration be done, so that’s what we’ll do. You might want to set some other variables, depending on your specific needs, so use this as a minimum, or starting point. We are just going to touch the most often needed values. These are
- no logging
- pre-set passwords to prevent interactive prompts
- move the network ranges away from the local network
- set the host IP
Lets go ahead and take a look at the devstack repo we cloned.
[root@stack tmp]# cd devstack [root@stack devstack]# ls clean.sh exerciserc files gate LICENSE pkg samples stack.sh unstack.sh doc exercises functions HACKING.rst MAINTAINERS.rst README.md setup.cfg tests driver_certs exercise.sh functions-common inc Makefile rejoin-stack.sh setup.py tools eucarc extras.d FUTURE.rst lib openrc run_tests.sh stackrc tox.ini [root@stack devstack]#
As you can see, there is a folder called samples, which is where the sample configuration files reside. By default, two files will be in the sample folder: local.conf and local.sh. We need to go ahead and copy local.conf in the root of devstack. Lets do that:
[root@stack devstack]# cp samples/local.conf local.conf
Now we have a local.conf to work with before we run stack.sh. Lets go ahead and open local.conf using your favorite editor. I prefer nano.
[root@stack devstack]# nano local.conf
The area we need to focus on is the localrc section, which is right at the top (it’s a little hard to catch the actual [[local|localrc]] because there are so many contents). In the localrc section, you will see the variables below, which you need to go ahead and set to your liking. First, lets get the passwords set. There are 4 passwords you need to set.
SERVICE_TOKEN=azertytoken ADMIN_PASSWORD=nomoresecrete MYSQL_PASSWORD=stackdb RABBIT_PASSWORD=stackqueue SERVICE_PASSWORD=$ADMIN_PASSWORD
Now we want to set the HOST_IP variable. It is autodetected by stack.sh, however there have been some issues with the script getting confused when the bridge interfaces are created. So, just to be safe we will set it (set it to the IP address of the server). Be sure to uncomment this line (remove the #). By default it’s commended out.
Go ahead and read through the comments and set any other variables you like. Pay close attention to the logging variables and make sure they are too your liking. When you are done, save and exit. We need to do one more thing before we can run the installation script; create a user account to run DevStack. You CANNOT rut as your root account. It will not let you. If you try, you will get this error:
[root@stack devstack]# ./stack.sh You are running this script as root. Cut it out. Really. If you need an account to run DevStack, do this (as root, heh) to create a non-root account: /tmp/devstack/tools/create-stack-user.sh
So, go ahead do what the message above instructs you to do if you have already created a non-root user to use.
[root@stack devstack]# /tmp/devstack/tools/create-stack-user.sh Creating a group called stack Creating a user called stack Giving stack user passwordless sudo privileges
This script creates a user and a group, both called stack, then assigns the stack user passwordless sudo privileges. Now, we need to give this new user ownership of the devstack folder and all files inside of it.
[root@stack devstack]# chown -u stack /tmp/devstack/
We can now switch user to stack and kick off the installation.
[root@stack devstack]# su stack [stack@stack devstack]$ ./stack.sh
Grab a cup of coffee, it will take a while. When the installation is finished, you will see something like this:
This is your host ip: 192.168.1.250 Horizon is now available at http://192.168.1.250/ Keystone is serving at http://192.168.1.250:5000/ The default users are: admin and demo The password: thepasswordyousetearlier
Now, before we can access the web interface, or work with OpenStack at all, the firewall needs to be configured to allow the necessary ports through, or disabled completely. Since we are setting up a development & research platform, I’m just going to turn the firewall off on my server. To do that, run this command:
[stack@stack devstack]$ sudo systemctl stop firewalld
Now, fire up a web browser on your workstation, and navigate to your host IP address, in my case http://192.168.1.250. You will be greeted with an OpenStack login page.
You can login with the username admin, and the password you selected in the configuration file (also shown at the end of DevStack installation).
Thats it! Next I’ll be adding images to OpenStack and creating instances. Stay tuned for more on that. Thanks!
Note: Once your DevStack environment is setup, DO NOT REBOOT!!!!! I have yet to find a reliable way to bring the system back to a functional state after a reboot. It might be worthwhile to set all of this up on a virtual machine, on the physical server, and take a running snapshot of it. That way, you can reboot and just restore that running snapshot. If you have any insight on bringing DevStack back online after a reboot, please let me know in the comments.