Home  >  Blog  >   OpenStack  > 

Creating a sandbox Compute server with VirtualBox and Vagrant - OpenStack

VirtualBox enables everyone to spin up virtual computers and networks without interfering with the rest of the workplace setting. It is accessible for free on Windows, Mac OS X, and Linux. By establishing a sandbox environment with VirtualBox and Vagrant, we can learn about and experiment with OpenStack.

Rating: 4
  
 
3188
  1. Share:
OpenStack Articles

Create a Sandbox Compute Server

Creating a sandbox server for running the OpenStack Compute services is very easy using VirtualBox and Vagrant. It allows us to discover and experiment with the OpenStack services.

VirtualBox gives us the ability to spin up virtual machines and networks without affecting the rest of our working environment and is freely available for Windows, Mac OSX, and Linux. Vagrant allows us to automate this task, meaning we can spend less time creating our test environments and more time using OpenStack. A Vagrant is installable using Ubuntu’s package management. This test environment is being used for the rest of this section.

It is assumed that the computer you will be using to run your test environment in has enough processing power that includes hardware virtualization support (modern AMDs and Intel IX processors) with at least 8 GB RAM. Remember, we’re creating a virtual machine that itself will be used to spin up other virtual machines, so the more RAM you have, the better it would be.

Learn how to use OpenStack, from beginner basics to advanced techniques, with online video tutorials taught by industry experts. Enroll for Free OpenStack Training Demo!

Getting started

To begin with, ensure that VirtualBox and Vagrant are installed and networking is set up as described in Previous Post, Keystone OpenStack Identity Service.

How to achieve it…

To create our sandbox server for running OpenStack Compute within VirtualBox, we will use Vagrant to define a second virtual machine that allows us to run OpenStack Cloud instances. This virtual machine, that we will refer to as the OpenStack Compute node, will be configured with at least 3 GB RAM, 2 CPUs, and 20 GB of hard drive space, and has three network interfaces. The first will be a NAT interface that allows our virtual machine to connect to the network outside of VirtualBox to download packages, the second interface which is the public interface of our OpenStack Compute host, and the third interface will be in our private network that OpenStack Compute uses for internal communication between different OpenStack Compute hosts.

MindMajix Youtube Channel

Carry out the following steps to create the virtual machine with Vagrant that will be used to run OpenStack Compute services:

1. Execute the steps mentioned in the ‘Creating a sandbox environment’ with a VirtualBox recipe of Previous Post, Keystone OpenStack Identity Service.

2. We are now editing the Vagrant file we have been working with, it looks like the following to add in our compute node:

-*- mode: ruby -*-

vi: set ft=ruby :

nodes = {                   => [1, 200],  

‘controller’  

‘compute’  =>                   [1, 201],  

}  

Vagrant.configure(“2”) do |config| config.vm.box = “precise64” config.vm.box_url

=”https://files.vagrantup.com/precise64.box”

nodes.each do |prefix, (count, ip_start)| count.times do |i|

hostname = “%s” % [prefix, (i+1)]

config.vm.define “#{hostname}” do |box| box.vm.hostname = “#{hostname}.book” box.vm.network :private_network, ip:

“172.16.0.#{ip_start+i}”, :netmask => “255.255.0.0”

box.vm.network :private_network, ip: “10.10.0.#{ip_start+i}”, :netmask =>

“255.255.0.0”

# If using VirtualBox

box.vm.provider :virtualbox do |vbox| vbox.customize [“modifyvm”, :id,

“–memory”, 1024]

if prefix == “compute”

vbox.customize [“modifyvm”, :id, “–memory”, 3172]

vbox.customize [“modifyvm”, :id, “–cpus”, 2]

end

end

end

end

end

end

3. We are now ready to power on our compute node. We do this by simply running the following command:

vagrant up compute

Note

Congratulations! We have successfully created the VirtualBox virtual machine running Ubuntu 12.04, which is able to run OpenStack Compute.

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 the Vagrant file 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 the following:

The hostname is called to compute

The VM is based on Precise64, an alias for Ubuntu 12.04 LTS 64-Bit. We have specified 3GB Ram and two CPUs.

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

vagrant up compute

Still more…

There are a number of virtualization products available that are suitable for trying OpenStack, for example, VMware Server, VMware Player, and VMware Fusion etc.

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

Join our newsletter
inbox

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
NameDates
OpenStack TrainingAug 05 to Aug 20
OpenStack TrainingAug 08 to Aug 23
OpenStack TrainingAug 12 to Aug 27
OpenStack TrainingAug 15 to Aug 30
Last updated: 04 August 2023
About Author
Remy Sharp
Ravindra Savaram

Ravindra Savaram is a Content 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.

Recommended Courses

1 /15