This is an update to my two posts ”Creating Virtual Images with VeeWee“ and „Virtual Machine Automation with Vagrant“. The last time I created “my own” Vagrant boxes was quite some time ago, and things have changed since then.
Instead of VeeWee I tried the combination of Bento and Packer as described in this post, since I had two fresh OS X 10.9.1 systems where I could try the procedure, plus an older 10.8.x machine.
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, run 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, run:
brew tap homebrew/binary
brew install packerStep 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 to build the box using the following commands:
cd bento/packer
packer build -only=virtualbox-iso centos-6.5-x86_64.jsonTroubleshooting
When I did this on my old MacBook Pro with OS X 10.8.x (I couldn’t remember the exact version ), I ran into two problems.
On my newer MacBook Pros I had no issues at all— it was pretty slick.
Problem 1
The first problem looked like this:
Failed to parse template: 1 error(s) occurred:
Unknown root level key in template: 'variables'I resolved it with:
brew link --overwrite packerProblem 2
Another error regarding VirtualBox:
virtualbox-iso: Error sending boot command: VBoxManage error: VBoxManage: error: Guest not runningThat one was resolved by repairing the disk permissions in OS X’s Disk Utility.
Step 7: Do the Vagrant stuff
Finally, get the 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 sshEnjoy your new box.
Conclusion
Compared to my first sessions with VeeWee and Vagrant, the combination of Vagrant, Packer, and Bento caused me less trouble creating a VM. The issues I encountered this time were only due to my older machine. As stated above, everything went smoothly on the two newer MacBook Pros.
If you want to read up on Vagrant, there ‘s now the Vagrant Cookbook. I haven’t read it yet; if you have, let me know what you thought.
Done for today!