Home  >  Blog  >   OpenStack

How to Create Sandbox Environment for the OpenStack

Rating: 4
  1. Share:
OpenStack Articles

Create Sandbox Environment 

Creating a sandbox environment by using VirtualBox and Vagrant allows us to discover and experiment with the OpenStack Compute service. VirtualBox gives us the ability to spin up virtual machines and networks without affecting the rest of our working environment, and is freely available at https://www.virtualbox.org for Windows, Mac OS X, and Linux. Vagrant allows us to automate this task, which means we can spend less time creating our test environments and more time using OpenStack. Vagrant can be installed using Ubuntu’s package management, but for another operating system, visit https://www.vagrantup.com/. This test environment is then used for the rest of this tutorial. It is assumed that the computer you will be using to run your test environment has enough processing power, including hardware virtualization support (for example, Intel VT-X and AMD-V have support with at least 8 GB RAM). Note that we’re creating a virtual machine which in turn is used to spin up virtual machines, so the more RAM you have, the better it would be.

If you would like to become an OpenStack  Certified professional, then visit Mindmajix - A Global online training platform:" OpenStack Certification Training Course ". This course will help you to achieve excellence in this domain.

Getting started

To begin with, we must download VirtualBox from https://www.virtualbox.org/ and then follow the installation procedure once it is downloaded. We also need to download and install Vagrant, which will be covered in the later section. The steps throughout the book assume the underlying operating system that will be used to install OpenStack on Ubuntu 12.04 LTS release. We don’t need to download an Ubuntu 12.04 ISO as we use our Vagrant environment for this purpose.

MindMajix Youtube Channel

How to achieve it…

To create a sandbox environment within VirtualBox, we will use Vagrant to define a single virtual machine that allows us to run all of the OpenStack Compute services required to run cloud instances. This virtual machine, that we will refer to as the OpenStack Controller, will be configured with at least 2 GB RAM and 20 GB of hard drive space and have three network interfaces. Vagrant automatically sets up an interface on our virtual machine, that is, NAT (Network Address Translate), which allows our virtual machine to connect to the network outside of VirtualBox to download packages. This NAT interface is not mentioned in our Vagrant file but will be visible on our virtual machine as ‘eth0’. We configure our first interface for use in our OpenStack environment, which will be the public interface of our OpenStack Compute host, a second interface will be for our private network that OpenStack Compute uses for internal communication between different OpenStack Compute hosts, and a third interface will be used when we look at Neutron networking in Chapter 8, “OpenStack Networking, as an external provider network”.

Carry out the following steps to create a virtual machine with Vagrant that is in turn used to run OpenStack Compute services:
1. Install VirtualBox from https://www.virtualbox.org/ . You will encounter issues if you are using the version shipped with Ubuntu 12.04 LTS
Tip:  The book was written using VirtualBox Version 4.2.16.
2. Install Vagrant from https://www.vagrantup.com/ . You will encounter issues if you are using the version shipped with Ubuntu 12.04 LTS.
Tip: The book was written using Vagrant Version 1.2.7.
3. Once installed, we can define our virtual machine and networking in a file called Vagrant file. To do this, we will create a working directory (for example, creates ~/ cookbook and edit a file in here called Vagrantfile as shown in the following command snippet:

Vagrantfile Command Snippet

4. We can now proceed to configure Vagrant by editing this file with the following code:

configure Vagrant
configure Vagrant 1

configure Vagrant 2

Frequently Asked OpenStack Interview Question & Answers

5. We are now ready to power on our controller node. We do this by simply running the following command:
vagrant up controller
Hurray! We have successfully created the VirtualBox virtual machine running on Ubuntu 12.04 which is now able to run OpenStack Controller services.

[ Related Article:- OpenStack Tutorial ]

How it works…

What we have done here is created a virtual machine within VirtualBox by defining it in Vagrant. Vagrant then configures this virtual machine, based on the settings given in Vagrantfile in the directory where we want to store and run our VirtualBox virtual machines from. This file is based on Ruby syntax, but the lines are relatively self-explanatory. We have specified some of the following:

1. The hostname is called “controller”
2. The VM is based on Precise64, an alias for Ubuntu 12.04 LTS 64-bit
3. We have specified 2GB RAM, 1 CPU, and an extra hard disk attached to our VM called “controller-cinder.vdi” that we will utilize later in our book.

We then launch this VirtualBox VM using Vagrant with the help of the following simple command:

vagrant up

This will launch all VMs listed in the Vagrantfile. As we have only one, this VM is the only one that has been started. To log into this new virtual machine, we use the a command as below:

vagrant ssh controller

Explore OpenStack Sample Resumes! Download & Edit, Get Noticed by Top Employers!  Download Now!

Still more…

A Vagrant and VirtualBox are not the only products for setting up a test environment. There are several numbers of other virtualization products available that are suitable for trying OpenStack, for example, VMware Server, VMware Player, and VMware Fusion, etc.


Join our newsletter

Stay updated with our newsletter, packed with Tutorials, Interview Questions, How-to's, Tips & Tricks, Latest Trends & Updates, and more ➤ Straight to your inbox!

Course Schedule
OpenStack TrainingApr 20 to May 05View Details
OpenStack TrainingApr 23 to May 08View Details
OpenStack TrainingApr 27 to May 12View Details
OpenStack TrainingApr 30 to May 15View Details
Last updated: 03 Apr 2023
About Author

Ravindra Savaram is a Technical Lead at Mindmajix.com. His passion lies in writing articles on the most popular IT platforms including Machine learning, DevOps, Data Science, Artificial Intelligence, RPA, Deep Learning, and so on. You can stay up to date on all these technologies by following him on LinkedIn and Twitter.

read more
Recommended Courses

1 / 15