Installing VirtualBox and Vagrant on Mac OS X Mavericks

I tend to go through periods of intense activity and learning and then get busy with regular life. Lately I've been spending a lot of my free time researching developments in the cloud computing space. I began looking at the OpenStack Essex release in mid-2012 but after a couple months my day job and family life got busy enough that I dropped it. About a month ago I dove back in have enjoyed getting back up to speed and learning about the innovation in private cloud and development.

I've been deploying OpenStack under Fedora 19 and Ubuntu 12.04 using VMware Fusion, but it has been fairly cumbersome to setup--especially Neutron. I've been thinking about using Vagrant to accelerate spinning up test environments, but the licensing cost to use with Fusion has been holding me back. Today I decided to download and install VirtualBox and Vagrant. If you aren't familiar and would like to better understand the benefits of using Vagrant read "Why Vagrant?" The short version is that Vagrant is a simple-to-use command line virtual machine manager.

Getting Started

First off get the VirtualBox binary here. At the time of writing the latest version is 4.3.10.

  • Mount the VirtualBox-4.3.10-93012-OSX.dmg disk image.
  • Double-click the VirtualBox.pkg icon.
  • Following the wizard to complete the installation.

Next download Vagrant here. The latest version is currently 1.5.3.

  • Mount the vagrant_1.5.3.dmg disk image.
  • Double-click the Vagrant.pkg icon.
  • Follow the wizard to complete the installation.

Up and Running

I have a "Development" directory under my /Users folder, so I launched Terminal and created a new project folder for this example. I then ran vagrant init and vagrant up and within a few seconds had a fully running Ubuntu 12.04 LTS 32-bit virtual machine in VirtualBox. The VM is stored in ~/VirtualBox VMs by default.

$ mkdir ~/Development/projects/foo
$ cd ~/Development/projects/foo
$ vagrant init hashicorp/precise32
$ vagrant up

At this point the VM is running. You can shut it down forcefully with vagrant halt or suspend with vagrant suspend. In either case, you restart it with vagrant up. You can see the name and status of the virtual machine with vagrant status, which becomes more useful for projects with multiple VMs.

$ vagrant status
Current machine states:

default running (virtualbox)  

You can SSH into this machine with vagrant ssh and when you are done get rid of it with vagrant destroy.

$ vagrant ssh
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic-pae i686)

 * Documentation:  https://help.ubuntu.com/
Welcome to your Vagrant-built virtual machine.  
Last login: Fri Sep 14 06:22:31 2012 from 10.0.2.2  
vagrant@precise32:~$  

Now that I have VirtualBox and Vagrant installed, I can greatly accelerate messing around with different environments, packages, applications, etc. While there are many other ways to accomplish the same thing so far I have been quite pleased with Vagrant and all the boxes available on VagrantCloud. Happy hacking!