Wandering by Kilimanjaro

Running Vagrant on my laptop. Let me tell more about my moster of a Laptop, I should have bought it but I did, its more of server on you lap than a lap top, its Asus’ Gaming Republic Laptop - G74SX-BBK7… now, go figure. I would rather keep it on the desk than on my lap. I have got all pieces of it working on my Manjaro so I am pretty settled now with it. Getting back to elasticity on my laptop, I decided to give Vagrant a shot. Vagrant is a ruby library aka tool(gem) that gives the power of spinning up virtual machines at will. Thats just one of it, but there are other neat things that you can do with it as well.

First up was to install Vagrant on Manjaro. As I have raved before, Manjaro’s Archlinux base did not let me down here either, it has another tool that picks from what they call as AUR(Archlinux User Repository) and install: yaourt(Yet AnOther User Repository Tool). Yes, all I needed to do is this.

~# yaourt -Ss vagrant
~# yaourt -S vagrant

This did install vagrant on Manjaro.  Now vagrant needs some supported hypervisor(called providers) to do its trick(which is to spin virtual machines at will), Virtualbox is supported out of the box, but the above command did not take care of installing virtualbox. The Archilinux has Virtualbox as part of their community repositories so I could install it using pacman.

~# pacman -Ss virtualbox>
~# pacman -S virtualbox

Now that I had installed both Vagrant and Virtualbox, the game was on. Had to jump right in. I needed to do just one thing before I started to to launch virtual machines using Vagrant. I needed boxes. Boxes are the way the Vagrant addresses the image files that it would launch as virtual machines. So I needed at least one of these. http://vagrantbox.es is the place I was looking, and fair enough, they have quite a few of these “boxes”. The vagrant box that I chose is Ubunut Precise64 box. And I added it to my vagrant setup to use.

~# vagrant box add precise64 http://files.vagrantup.com/precise64.box

This added the precise64 to the list of available boxes to be launched.

~# vagrant box list
precise64 (virtualbox)

Now that I had this box available, I was good to go. Had to make a directory which would be the home for my vagrant instance and bring it up.

~# mkdir vagrantup
~# cd vagrantup

All I then needed to do was initilize vagrant config.

~/vagrantup # vagrant init
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.

This creates a Vagrantfile which describes of how the virtual machine would be configured. There is one thing I would change in this file.

 # Every Vagrant virtual environment requires a box to build off of.
 config.vm.box = "precise64"

Saved this file, and finally, time to switch on the machine.

~/vagrantup# vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'precise64'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
[default] Mounting shared folders...
[default] -- /vagrant

Now the machine was running, all that was left was to log into the machine to see if it worked.

~/vagrantup# vagrant ssh
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic x86_64)
  • Documentation:  https://help.ubuntu.com/
    Welcome to your Vagrant-built virtual machine.
    Last login: Fri Sep 14 06:23:18 2012 from 10.0.2.2
    vagrant@precise64:~$ logout
    Connection to 127.0.0.1 closed.
    ~/vagrantup#

It worked like a breeze. There are some awesome advantages that Vagrant gives developers. I will write about it soon. 

Show Comments