Mar 11, 2014

Setup Openstack in a VM w/ Devstack Step-by-Step

Learning openstack is not an easy task for me, because I don't have much linux knowledge. During the openstack setup process followed by Openstack.org official installation guide, I spent more than 3 hours to install necessary modules and modified the configuration files one by one.
But I failed and I cannot figure out what the problem is...maybe I should spend more time to understand each action and verify it one-by-one.

But I don't have so much time to waste on installation procedure, I need to familiar the openstack as soon as possible to test its feature.
So I tried to leverage Devstack all-in-one install script to help me to learn what is openstack and see how it works.

However, its still not just so simple just like Devstack.org said if you are installing openstack first time:

So I would like to share my step-by-step experience here(especically the preparation of necessary steps):

1. Install ubuntu 12.04 Server in VM
If you are not familiar with ubuntu like me, you can refer to below URL of step-by-step installation guide)

2. Setup a Openstack user(stack)
You need to have a sudoers account in ubuntu server:
sudo bash
adduser stack
Add below statement to/etc/sudoers
stack ALL=(ALL) NOPASSWD: ALL 
 

3. Swtich to the user
Change as the user then change directory to confirm that you are under the user(stack) home directory to prepare install Devstack
su stack
cd
pwd

4. Updade apt-get all packages
In many articles suggest to update all packages before install openstack, so let's do it!
sudo apt-get update
sudo apt-get upgrade
 
 

5. Install git
The challenge of linux rookies is lacking of the knowledge about different linux platform pre-install tool. And rookies don't know how to proceed to solve the problem when met an error message prompt with 'command not found'.
Devstack would need the git, but this tool will not be installed in a clean ubuntu server environment, please install the git at first before you download devstack project.
sudo apt-get install git -y
 
6. Download Devstack project
git clone https://github.com/openstack-dev/devstack.git
cd devstack/

6. Switch to the Havana branch
Devstack, like openstack, is a living breathing project and like most projects undergoing active development, it has bugs and issues. You can always run the latest and greatest devstack code (the ‘master’ branch) but you risk encountering whatever issues the Openstack developers just ran into. Running from a stable branch makes sense for most cases.
git checkout stable/havana

7. Run the Devstack script
This script takes a while to run. It installs Mysql, RabbitMQ, compiles the openstack binaries and set up a whole bunch of stuff.
./stack.sh

Please be patient with the installation, because it would spend at about 10~20mins(depends on your internet and machine hardware)



If you can see below message, it means the script finishes and devstack is up and running.

 

8. Login Openstack Horizon portal
Open a browser with the URL as the screen result – the openstack dashboard (called Horizon) should be up and running and you can login using admin/password.(in order to follow the steps, I would suggest all use the same password 'password' during the installation for lab use only.




 

You can make it!
To speak frankly, Devstack really helps if you are not familiar with linux and openstack in details, I just spend 1 hour to setup the openstack environment successfully by the devstack script. I assume most of you can do it better than me!

Restart VM then Devstack will fail to login
I found the Devstack has problem when you reboot the VM, so I found a workaround from this website - Restarting DevStack
Once DevStack is up and running, its can be a great way to play around with OpenStack. When the instance of DevStack is restarted, some services may not startup. When trying to login to the OpenStack Dashboard, one gets an generic error.
You can follow below procedure to fix this issue.(NOTE: Ensure the script is placed in the local devstack folder as it relies on files in the original DevStack folder)
wget http://www.scalegrid.net/blog/wp-content/uploads/2012/06/restart_stack.txt
mv ./restart_stack.txt ./restart_stack.sh
chmod 775 ./restart_stack.sh
./restart_stack.sh
Rollback...
Sometimes, you maybe unlucky and failed without obviously error message, so you may like to re-install it. Please do the following steps:
1. To shutdown devstack, run:
./unstack.sh
2. clean up all the files that devstack installed, run:
./clean.sh
sudo rm -rf /home/stack/devstack (if you are using the user 'stack' and install devstack under the home directory of 'stack')
sudo rm -rf /opt/stack
Reference:
As blow are the resource I found and followed, you can check it for additional useful links in the blog.(but as I said,..many blog contents may not update-to-date, so even you follow the exactly step with it, but you still have the chance to fail...)

Post a Comment