vagrant and ubuntu

Vagrant was in my TODO for over one year, its good i finally played with it. I will explain what/how i installed it so whoever wants to play with it can easily deploy & use it. I tested in on ubuntu 10.04 (yeah my old box) ¬†but i would/will guarantee it will work on all newer releases. ūüėÄ

Things/packages needed to run Vagrant

1. Virtualbox

To install virtualbox simply visit virtualbox official site and follow this install instruction just choose the ubuntu version you are running it. For me i used the repo for lucid & it will be different for you. Also a word of advice kindly install older version of Virtualbox as we have a known issue of NS_ERROR_CALL_FAILED in its latest version. I installed 4.1 in my case.

After successful installation of virtualbox this is how it looks.

     $ VBoxManage --version

2. Vagrant

I installed vagrant by downloading latest binary from the their website Once i had it installed. It was 3 simple step to get Vagrant up & running.

$ vagrant init precise32
$ vagrant up
$ vagrant ssh

What this two command does is it gets you the base image which subsequently used for next time bringing up the instance. As you can see it takes precise(12.04) image.  Once you have the instance up. You can simply log into the machine via SSH.

The Catch 

By default the instance a bought up with NAT networking mode & you are easily able to access it from your system. In most cases we need Bridge network enabled so the machine/VM can acquire the network IP & additional interface. You need to add the same in the config file of vagrant which is in your home directory.

$ cat Vagrantfile

The old document of vagrant tells you the way how to do it but this will not work in our case. In order to get in working one has to add below mentioned lines inside the “Vagrantfile” as am using my wireless network. :public_network, :public_network => "wlan0"

After changing this configuration once you will run the commands

$ vagrant up
$ vagrant ssh

You will be able to see additional interface at “eth1” mapped to the bridge network. You can check other simple vagrant commands as well needed to destroy/suspend

$ vagrant --help
Usage: vagrant [-v] [-h] command []

    -v, --version                    Print the version and exit.
    -h, --help                       Print this help.

Available subcommands:

For help on any individual command run `vagrant COMMAND -h`

What will i do with Vagrant?

Well am going to use it from now on to test all my custom scripts besides i also need to test Kevins OpenStack cookbook which extensively uses vagrant.

Lastly i can say night well spent credit goes to Kev!! ūüôā

Installing it on Ubuntu 12.04

I just got a precise box & deploying Vagrant is very simple, it will bring Virtualbox as well as dependency. ūüôā

$ sudo apt-get install vagrant
$ vagrant up
$ Vagrant ssh

Hope it helps.