Linux.com

Home Learn Linux Linux Tutorials Intro to OpenStack Part Two: How to Install and Configure OpenStack on a Server

Intro to OpenStack Part Two: How to Install and Configure OpenStack on a Server

Last week we learned what OpenStack is and what it does. Today we'll install it on a single machine and make it do stuff. This is not how you would set up a production server, but it's a wonderful fast way to get a testing and learning server running.

There are three fairly easy ways to get your hands on OpenStack and try it out: one is to use a commercial public cloud like Rackspace or Cloudwatt, or the free Trystack. If you're in a hurry go for one of the paid services, because it can take days to weeks to get approved for a Trystack account. Using a public cloud is a good way to dive right into developing and testing applications.

Figure 1: A successful OpenStack installation.If you're more interested in spelunking into the guts of OpenStack and learning how to administer it then you can build your own server to play with, and that is what we're going to do with the DevStack installer. DevStack is an amazing shell script that installs the OpenStack components, a LAMP stack and CirrOS, which is a tiny Linux distro built for running cloud guests. (Cirrus? Get it? Finally a good geek pun.) I am going to cover installation in detail, because even though it's easier than it's ever been it's still a bit tricksy.

Getting Started

With most Linux applications it's safe to install and remove and play with whatever you want to test on your main Linux PC, because Linux is a grown-up operating system that does not keel over when you ask it to do work. Unlike certain overpriced proprietary operating systems that are delicate and full of excuses. But I digress.

Don't put OpenStack on your main PC because it needs a dedicated system, so for this article I'm running it in VirtualBox on Lubuntu 12.04 on my Linux Mint 13 system. Sure, I know, real server nerds don't run a graphical environment on their servers, but for testing it's a nice convenience, and Lubuntu is lightweight. If you elect to run OpenStack server in a virtual machine give it a minimum of 1.5GB RAM and 6GB storage. If you have a multicore system and can spare more than one core, do so because OpenStack, even in a simple testing setup, gets hungry.

First create a user named stack to use for installing DevStack:

$ sudo useradd stack
$ sudo passwd stack
Enter new UNIX password: 
Retype new UNIX password: 

Then give stack full sudo privileges:

$ sudo visudo
stack ALL=(ALL:ALL) NOPASSWD: ALL

Now logout, and then log back in as stack. If you don't have git then install it:

$ sudo apt-get install git -y

Then pull OpenStack from Github. This copies it into the current directory, so I cd to /var and then run git:

$ git clone git://github.com/openstack-dev/devstack.git

This puts everything in /var/devstackcd to devstack, and take a few minutes to look in the various scripts and files. For whatever reason, which I have not figured out, I ran into permissions problems on my first run, so I changed ownership of /var/devstack and /opt/stack to stack:

$ sudo chown -R stack:stack /opt/stack
$ sudo chown -R stack:stack /var/devstack

I also changed /var/www to www-data:www-data; Ubuntu's default is root, which is not a good practice.

It is good to have logging, so create /var/stacklog, and make it owned by stack.

Configuration

There is one more prerequisite, and that is to create /var/devstack/localrclocalrc always goes in your DevStack root, and it configures networking, passwords, logging, and several other items we're going to ignore for the time being. This is what mine looks like, just a minimal configuration:

HOST_IP=10.0.1.15
FLAT_INTERFACE=eth0
FLOATING_RANGE=10.0.1.224/28
ADMIN_PASSWORD=supersecret
MYSQL_PASSWORD=supersecret
RABBIT_PASSWORD=supersecret
SERVICE_PASSWORD=supersecret
SERVICE_TOKEN=supersecret

OpenStack uses a lot of passwords, so for testing I make it easy on myself by recycling the same one. The HOST_IP is the ethX inet addr of your OpenStack server, whether it's virtualized or not, like this example:

$ ifconfig
eth0  Link encap:Ethernet  HWaddr 90:ee:aa:a2:50:aa  
      inet addr:10.0.1.15  Bcast:10.0.1.255  Mask:255.255.255.0

Do create a static IP address for your DevStack server, or you will suffer. Networking is rather involved for OpenStack, and we'll get into that more in the future; for now we'll keep it as simple as possible.

FLAT_INTERFACE is the server's Ethernet interface; if you have just one it's not necessary to include this line. You could have an internal and a public-facing interface, just like on non-cloud servers, and the FLAT_INTERFACE corresponds to the internal interface.

FLOATING_RANGE is a pool of addresses for any OpenStack servers that need to be available to the network. This must not overlap with the server's IP address, which is why my example is way out at the end of the address range.

The Horizon dashboard, after OpenStack installation.Alrighty then, it's time to finish the installation. Change to /var/devstack and run:

$ ./stack.sh

This will run for a while and fill your screen with all kinds of output. Go take a nice break and think about pleasant things. When it completes a successful run you'll see something like figure 1, above.

Now fire up a Web browser on your OpenStack server and point it to the IP address it told you, which in my example is http://10.0.1.15. If you see the login page you may congratulate yourself for a successful installation, and for accessing the Horizon dashboard (figure 2.) Go ahead and login as admin with whatever password you set in localrc. You can poke around and explore the different screens without hurting anything. There isn't much to see yet, but you'll find a few images and report pages.

If you make a mess, the good DevStack people included a do-over script, clean.sh. This reverses stack.sh and leaves your git clone files in place, so run clean.sh and then stack.sh to re-do your installation.

That's all for today, so come back next time to learn how to access Horizon from a remote PC, and how to do some basic setup.

 

Comments

Subscribe to Comments Feed
  • Russell Bryant Said:

    I think this is bad advice. Devstack is really only intended for development environments. It's not something I would recommend as a way to install for any type of "real" usage. Use distro packages and an installer. If you're trying it on a Red Hat based platform (RHEL, or a derivative such as CentOS), try installing using the packstack installer. http://openstack.redhat.com/Quickstart

  • John Spaetzel Said:

    Did you even read?... "spelunking into the guts of OpenStack and learning how to administer it then you can build your own server to play with, and that is what we're going to do with the DevStack installer"

  • Mike Said:

    another example of someone who didn't R.T.F.M., John...

  • Mike Said:

    Why doesn't Linux.com provide a link for emailing articles in addition to the links above??

  • Jcaikai Said:

    Not sure why some may think that this is bad advice. I for one think this is an amazing guide to just diving in and learning the ropes of a quite complex framework. I guess some people really love to just criticize without taking the time to RTFML.

  • myles Said:

    I'm receiving the "keystone did not start" error. Is anyone else running into this problem?

  • geetha Said:

    iam also receiving "keystone did not start " ..what to do to start keystone?

  • King_2188 Said:

    For testing purposes this works fine. Great article and followthrough as well. Funny, the people who write negative comments on here probably couldn't get their VM's up and running. Thanks again!

  • linuxUsr117 Said:

    Failed for me; one error after another.

  • superbird Said:

    If you have problem to install OpenStack, there is an easier way to try it. A PAID AMI on Amazon EC2 called NanoStack ((https://aws.amazon.com/marketplace/pp/B00F2NNR3C) can start an OpenStack in less than a minute. It's a pre-configured all-in-one OpenStack installation. It's a pretty cheap way to play with OpenStack.

  • adam Said:

    Failed for me too. Keystone issue. Am troubleshooting it now. Most likely centos6 has the same problem as fedora15+ mentioned here http://docs.openstack.org/developer/keystone/setup.html . Unfortunately troubleshooting it means that I have to dig into all the components anyway. The project is very promising but is still too complex for convienant installation. Compared to vSphere it's looks like a frankenstein monster (just my first impression) I hope to give more positive output after getting it up.

  • Kees Said:

    Tested and works, failed on a VM. Follow this steps: http://tomvanbrienen.nl/openstack-environment-centos/ dutch, but works for me.

  • Jason Bridget Said:

    yeah it didnt work for me ,too. then find this one. it is working fine on vmware esx 5. http://www.redhathowto.com/?p=79

  • Dariem Said:

    Why is a good practice the ownership of /var/www by www-data? Wouldn't that means that a succesful exploitation of a vulnerable web aplication can grant permissions to write in /var/www, given that Apache runs as the user www-data?

  • Peeyush Said:

    All who are failing to get devstack work, I just want to say Devstack is not fully reliable. As far as I have experienced, it fails an awful lot of times, but when it works, it's the easiest way to deploy openstack. So just keep cleaning the system, and try in again. Better, provision a new VM and try devstack on it.

  • Dale Said:

    I'm with Russell; if you want to find out what OpenStack is, how it works, and how to best deploy to a server, install the beast yourself rather than go to a time-wasting install kit. It might seem more painful (but that is superficial given the installer's problems), but you'll understand everything soooo much better once you have it cracked.

  • Debasish Garai Said:

    This is a good article. I read it and followed. I was able to install it and also access the web ui. I would like to know if there is article about how to do some stuffs to get familiarity with open stack.

  • Fred Said:

    devstack is not working on CentOS 6.5: exercise.sh reports: ERROR (ConnectionError): [Errno 111] Connection refused ===================================================================== SKIP marconi SKIP neutron-adv-test SKIP sahara SKIP swift SKIP trove FAILED aggregates FAILED boot_from_volume FAILED bundle FAILED client-args FAILED client-env FAILED euca FAILED floating_ips FAILED horizon FAILED sec_groups FAILED volumes I have used OpenStack Cloud in the Box last year but I can't find that procedure

  • Akhilesh Said:

    Can you please tell me how to resolve this issue. I followed the above steps but getting below errors + sudo mysqladmin -u root password password mysqladmin: connect to server at 'localhost' failed error: 'Access denied for user 'root'@'localhost' (using password: NO)' + true + sudo mysql -uroot -ppassword -h127.0.0.1 -e 'GRANT ALL PRIVILEGES ON *.* TO '\''root'\''@'\''%'\'' identified by '\''password'\'';' ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)


Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board