Skip to main content

Vagrant Revisited

·2 mins

This is an update to my two posts ”Creating Virtual Images with VeeWee“ and „Virtual Machine Automation with Vagrant“. The last time I was creating “my own” Vagrant boxes is quite some time ago and things have changed since then.

Instead of VeeWee I have tried the combination of Bento and Packer as described in this post since I had two fresh OSX 10.9.1 systems where I could try the procedure, plus an old 10.8.x.

From ISO to Virtual Machine in 7 Steps #

Step 1: Install VirtualBox #

Download VirtualBox from their site and install it.

Step 2: Install Homebrew #

In your terminal just type this one-liner:

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"

Step 3: Install Vagrant #

Download Vagrant from here and install it.

Step 4: Install Packer #

Back in your terminal do the following:

 brew tap homebrew/binary
 brew install packer

Step 5: Get Bento #

Switch to your project or working directory and get bento:

git clone https://github.com/opscode/bento.git .

Step 6: Build CentOS #

Time for building the box with the following commands:

cd bento/packer
packer build -only=virtualbox-iso centos-6.5-x86_64.json

Troubleshooting #

When doing this on my old Mac Book Pro with OSX 10.8.x (can’t remember which version it was exactly), I ran into two problems.

On my fresh Mac Book Pros I had no issues at all. Pretty sleek.

Problem 1 #

The first problem I ran into looked as follows:

 Failed to parse template: 1 error(s) occurred:
 Unknown root level key in template: 'variables'

I was able to resolve that with the following command:

brew link --overwrite packer
Problem 2 #

Another error regarding Virtual Box:

virtualbox-iso: Error sending boot command: VBoxManage error: 	VBoxManage: error: Guest not running

That one got resolved by repairing the disk permissions in OSXs Disk Utility.

Step 7: Do the Vagrant stuff #

Finally, let’s get that box up and running:

vagrant box add my_centos_65 ../builds/virtualbox/opscode_centos-6.5_chef-provisionerless.box
  vagrant init my_centos_65
  vagrant up
  vagrant ssh

Enjoy your new box.

Conclusion #

Compared to my first sessions with Veewee and Vagrant, I must say that the combination of Vagrant, Packer and Bento caused me less trouble creating a VM. Those troubles I had this time were only because of my old machine. As stated above, everything went smooth on the two Mac Book Pros that were new.

If you want to read up on Vagrant, there is now the Vagrant CookBook. Have not read it, yet. In case you did, let me know how you liked it.

Done for today!