date | draft | weight | title |
---|---|---|---|
2016-08-12 |
false |
16 |
Lab 16 - Build your own OpenStack environment at home |
The objective of this lab is to teach students how to take an Ubuntu 14.04 (LTS) machine and stand-up an OpenStack environment so that you may continue your exploration of OpenStack on your own time outside of class. You might use an old laptop, AWS, Google Cloud, or use a VMWare or Xen to run it as a VM. The only prerequisite, is that you have a new install of Ubuntu 14.04 (or 16.04) on the machine.
This lab doesn't actually install OpenStack, it installs DevStack. As the name implies, DevStack is for developers. It is designed to install on a single or dual-node system (the steps listed are for a single node system). Rather than do this lab in class, the instructor will demo it for you.
As the name implies, "DevStack" builds change rather rapidly. If you run into issues with the installation process, it might be worth re-trying these install steps 24 hours later (bugs are are typically fixed quickly).
Tested with Oracle VirtualBox 5.0.6 for Windows
- Deployed on a single VirtualBox VM with access to 4 gigs RAM, 1 NIC, 2 cores, and a 20 gig drive
- No issues installing DevStack within a VirtualBox environment
Tested with VMWare vSphere ESXi VM
- Deployed on a single ESXi VM with access to 4 gigs RAM, 1 NIC, 2 cores, and a 20 gig drive
- No issuess installing DevStack within an ESXi environment
Ubuntu 14.04 Desktop (or Server) is available here
- If you use Ubuntu 14.04 Desktop, then you can use the browser in Ubuntu to access Horizon. If you use the Server distro, you'll need to configure HTTP access and access Horizon from your host OS
- In all cases, default settings were chosen for installation
-
Issue the following commands to the Ubuntu CLI:
[ubuntu@PC01 ~]$
sudo apt-get update
[ubuntu@PC01 ~]$
ip a
Record the IP address of your VM. Mine was 10.0.2.15
[ubuntu@PC01 ~]$
sudo apt-get install ntp
[ubuntu@PC01 ~]$
cat /etc/ntp.conf
- You will see lots of lines, but the NTP servers being used are the following:
server 0.ubuntu.pool.ntp.org server 1.ubuntu.pool.ntp.org server 2.ubuntu.pool.ntp.org server 3.ubuntu.pool.ntp.org
[ubuntu@PC01 ~]$
sudo timedatectl set-timezone UTC
[ubuntu@PC01 ~]$
sudo /etc/init.d/ntp restart
[ubuntu@PC01 ~]$
timedatectl
[ubuntu@PC01 ~]$
sudo apt-get install git -y
[ubuntu@PC01 ~]$
pwd
[ubuntu@PC01 ~]$
git clone https://git.openstack.org/openstack-dev/devstack
[ubuntu@PC01 ~]$
ls
[ubuntu@PC01 ~]$
cd devstack
[ubuntu@PC01 ~]$
less stack.sh
Press q to quit
[ubuntu@PC01 ~]$
less unstack.sh
Press q to quit
[ubuntu@PC01 ~]$
less clean.sh
Press q to quit
[ubuntu@PC01 ~]$
less samples/local.conf
Press q to quit
[ubuntu@PC01 ~]$
./run_tests.sh
Confirm that all of the tests pass
Now to configure stack.sh. DevStack includes a sample in ~/devstack/samples/local.conf. The local.conf has the following parameters that need to be defined:
- Set FLOATING_RANGE - A range not used on the local network, i.e. 192.168.1.224/27. This configures IP addresses ending in 225-254 to be used as floating IPs.
- Set FIXED_RANGE and FIXED_NETWORK_SIZE to configure the internal address space used by the instances.
- Set FLAT_INTERFACE to the Ethernet interface that connects the host to your local network. This is the interface that should be configured with the static IP address mentioned above.
- Set the administrative password. This password is used for the admin and demo accounts set up as OpenStack users.
- Set the MySQL administrative password. The default here is a random hex string which is inconvenient if you need to look at the database directly for anything.
- Set the RabbitMQ password.
- Set the service password. This is used by the OpenStack services (Nova, Glance, etc) to authenticate with Keystone.
- Copy the setup file into ~/devstack, then explore what it contains. It is okay to leave this file as it. When the installation finishes, it will announce your sign in / password
ubuntu@PC01:~/devstack$
cp samples/local.conf ~/devstack/local.conf
ubuntu@PC01:~/devstack$
cat local.conf
-
ubuntu@PC01:~/devstack$
script -a ~/stack.out
-
ubuntu@PC01:~/devstack$
./stack.sh
Note the current time. The installation of DevStack will take a bit; we've clocked it around 28 minutes. This is a good time to review the stack.sh documentation (http://docs.openstack.org/developer/devstack/stack.sh.html), as well as documentation on the DevStack project (http://docs.openstack.org/developer/devstack/). Be sure to keep checking the status of the installation. If something fails, it is important to catch it as quickly as possible.
ubuntu@PC01:~/devstack$
exit
ubuntu@PC01:~/devstack$
less ~/stack.out
ubuntu@PC01:~/devstack$
ls -l /opt/stack/logs
ubuntu@PC01:~/devstack$
cat ~/devstack/openrc
ubuntu@PC01:~/devstack$
source openrc admin admin
less /opt/stack/logs/stack.sh.log ## this doesn't work
diff ~/stack.out /opt/stack/logs/stack.sh.log
This section will log you get you logged into Horizon, and give you some direction, but it's up to you to explore and continue your OpenStack education. The installation of DevStack is quick and painless, so don't be afraid that you might 'break' something! Refer to previous labs if you get stuck.
- Log into Horizon (user: admin // password: nomoresecrete)
-
http://<IP address of Ubuntu VM>/dashboard
NOTE: At this time, you can sign into Horizon, but it is throwing errors, however, the CLI seems to work fine. Check back soon for a Horizon fix.
- To work from the CLI, type the following:
ubuntu@PC01:~/devstack$
source openrc admin
- This will not change your command prompt like it did in class, however you are now sourced as admin
- Launch the python-OpenStack wrapper (easy place to start from)... think of this platform as the CLI version of Horizon. You can issue a common set of commands from here
ubuntu@PC01:~/devstack$
openstack
(openstack)
help
- Help will return the common set of commands you can issue to OpenStack openstacks
-
Use Horizon and the CLI to complete the following tasks (to access the CLI, use PuTTY [Windows] or Terminal [Apple])
-
Horizon tasks
-
Create the project timelords
-
Add the user thegooddoctor to the orion project
-
Add the user amypond to the orion project
-
Create a private network gallifrey
-
Create a router called timelord on the gallifrey network
-
Create a security group called http-ssh allowing HTTP and SSH access
-
Start an instance named tardis in the orion project
-
Create a 1 GB volume named vault and attach it to tardis
-
-
CLI tasks
-
SSH into the instance tardis and confirm you can see your new 1 GB volume
-
Create the project camelot
-
Add the user kingarthur to the camelot project
-
Add the user sirrobin to the camelot project
-
Start an instance in the camelot project
-
-
-
Enjoy! Don't be afraid to explore. If you come up with any 'cool' tasks, be sure to let us know!
** THANKS AGAIN FOR TRAINING WITH ALTA3 RESEARCH!!!***