Installing Devstack on a Vagrant virtual machine

I was a bit lost when I started looking for documentation about devstack. Vicky told me about terriyu’s blog which helped me.

Before starting with the Developer’s Guide, I installed ubuntu 14.04 (trusty64). If you don’t want ubuntu you can use Fedora 22 (or Fedora 23) and CentOS/RHEL 7 and find documentation here.
In order to correctly install all the dependencies, you should assume a specific minimal version of the supported distributions to make it as easy as possible. DevStack will perform best with 4GB or more of RAM.

Why use a virtual machine? It’s the recommended way to install Devstack if is your first time. You don’t want lots of dependencies installed on your everyday environment. If something breaks, it’s easier to start over from scratch if you’re working in a VM.

Why use vagrant? Vagrant provides easy to configure, reproducible, and portable work environments. If something goes wrong you just can reuse the vagrantfile to configure a new vm.

Why VirtualBox? it is free, available on every major platform, and built-in to Vagrant.

Building-a-development-environment-from-a-production-website-with-Vagrant-and-VirtualBox.png

 

1.INSTALLING VirtualBox
Debian-based Linux distributions (oracle_vbox.asc)
Add the following line to your /etc/apt/sources.list:

deb http://download.virtualbox.org/virtualbox/debian trusty contrib

downloading and registering:

wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -

The key fingerprint for oracle_vbox.asc is

7B0F AB3A 13B9 0743 5925 D9C9 5442 2A4B 98AB 5139
Oracle Corporation (VirtualBox archive signing key) <info@virtualbox.org>

check key by examining its fingerprint:

$ apt-key finger | grep VirtualBox -3
sudo apt-get update
sudo apt-get install virtualbox-5.0

2.INSTALLING VAGRANT
The installer will automatically add vagrant to your system path so that it is available in terminals.

wget https://releases.hashicorp.com/vagrant/1.8.1/vagrant_1.8.1_x86_64.deb
sudo dpkg -i vagrant_1.2.7_x86_64.deb

3.Discovering boxes and configure Vagrantfile
Create a dir to work in:

mkdir ~/vagrant_devstack 

cd ~/vagrant_devstack

A box is based on a specific operating system possibly with additional software and configurations.The easiest way to find boxes is to look on the public Vagrant box catalog for a box matching your use case.

$ vagrant box add ubuntu/trusty64

You can also quickly initialize a Vagrant environment with

 vagrant init ubuntu/trusty64

and you should see the output

A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.

The primary function of the Vagrantfile is to describe the type of machine required for a project, and how to configure and provision these machines. Vagrant is meant to run with one Vagrantfile per project.

 vagrant_devstack /vim Vagrantfile

We are going to setup port forwarding and increase the RAM by altering the Vagrantfile. Open the Vagrantfile in your favorite text editor and see if there are any lines matching

# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network :forwarded_port, guest: 80, host: 8080

If you find the matching lines, uncomment the last line so that you have

config.vm.network :forwarded_port, guest: 80, host: 8080

If you don’t have the matching lines, then manually copy and paste the above line to the Vagrantfile.

DevStack will perform best with 4GB or more of RAM. The default RAM in a VagrantVM is 360 MB, so we need to change this. At the bottom:

config.vm.provider :virtualbox do |vb|
  vb.customize ["modifyvm", :id, "--memory", "[RAM]"]
end

Here’s my vagrantfile

vagrant up --provider virtualbox 
vagrant ssh

 

  • In order to be able to run a 64-Bit system in a VirtualBox, you need a cpu which supports virtualization. AMD calls this function AMD-V, Intel uses VT-x.You can check your system by…
$ egrep '(vmx|svm)' /proc/cpuinfo
  • If you don’t get any output, you’re not able to run a 64-Bit OS as guest inside your VirtualBox. But don’t forget to check your BIOS settings. You might be able to activate these AMD-V/VT-x features inside the BIOS of your computer.

logo-blue

Check that your virtual machine has the RAM you want:

vagrant@precise64:~$ grep MemTotal /proc/meminfo

Now, let’s update the package lists from the Ubuntu repositories and install git and vim:

vagrant@precise64:~$ sudo apt-get update
vagrant@precise64:~$ sudo apt-get install git vim-gtk

Clone the Devstack GitHub repository:

vagrant@precise64:~$ cd ~
vagrant@precise64:~$ git clone git://github.com/openstack-dev/devstack.git

then copy the sample local.conf to the top-level of the devstack repository:

vagrant@precise64:~$ cd ~/devstack
vagrant@precise64:~$ cp samples/local.conf .

This file local.conf allows you to configure user-defined variables in the stack.sh script which installs Devstack.

I recommend not to run stack.sh until you add some configuration lines  of the project you had chosen  to local.conf file. 

DONE! Now, you need to work on a project. Please, don’t clone a git repository in the usual way, as the guide demands, just add some lines inside local.conf and run stack.sh. I’ll write about how to install Cinder and Ceph.

Please take a look at developer’s guide:

  1. You’ll need a Launchpad account
  2. Installing git-review
Advertisements

Author: enriquetaso

Outreachy intern. Really happy to be part of OpenStack community. LinuxChix Argentina member. Python Girl.

2 thoughts on “Installing Devstack on a Vagrant virtual machine”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s