CNK's Blog

Vagrant

Update VirtualBox

So I want to get started with Vagrant again. So before getting started, I updated my VirtualBox install to 4.2.12. My Ubuntu VM still works just fine. So now I can move on to Vagrant.

Installing Vagrant

The last time I played with Vagrant it was distributed as a Ruby gem but apparently that is now deprecated. Following the instructions on the Getting Started Guide I first found and removed old copies of vagrant that I had. All of them seemed to be installed in a ruby 1.9.3 patchset that I didn’t have any more, so I just deleted the gem directories for that ruby.

While I was looking at my rubies and gemsets, I went ahead and updated the gems in my default ruby’s global gemset. I was a little surprised that I have a minitest gem installed (Doesn’t minitest ship with ruby now?) and that I appear to have quite an old version (Aug 27, 2011 according to the version list on rubygems.org). Curiouser and curiouser.

    bundler (1.3.0 < 1.3.5)
    io-console (0.3 < 0.4.2)
    json (1.5.5 < 1.7.7)
    minitest (2.5.1 < 4.7.1)
    rake (10.0.3 < 10.0.4)
    rdoc (3.9.5 < 4.0.1)
    rvm (1.11.3.6 < 1.11.3.7)
    slop (3.4.3 < 3.4.4)

Anyway, back to Vagrant. I downloaded the dmg for v1.2.1 and ran the installer. I see a Vagrant folder in my Applications folder - and /usr/bin/vagrant is available and shows the expected version number.

Making a VM

I have some other VirtualBox VMs installed in ‘/Users/cnk/VirtualBox VMs’ So it seems logical to add more there. I have a kind of mix of stuff in that directory so at some point I need to go back and figure out what pieces go with what other pieces. For now, let’s make a new directory for my new box, and initialize vagrant:

    $ cd /Users/cnk/VirtualBox\ VMs
    $ mkdir edx
    $ cd edx
    $ vagrant init

To create a VM I need a ‘box’ to use as a base image. The default in the Vagrant docs is precise32 which is an Ubuntu image. I may have to learn to like Ubuntu since last time I looked, the base VirtualBox images available for Ubuntu were a LOT smaller than the RHEL/CentOS ones I am more familiar with. ‘vagrant box list’ actually turns up a lucid32 image from ???? Apparently vagrant stores the boxes in ~/.vagrant.d/ by default. I see that directory - with a boxes/lucid32 subdirectory. However, I also have a directory, ~/.vagrant. From the moddates and boxes listed, this is from the first time I played around with Vagrant (for setting up sandboxes to run Brakeman in). If I ever need those images again, I may need to figure out if I can just move them. But for now, I am just leaving them alone.

I am a little disappointed that vagrantup.com doesn’t have a semi-authoritative list of available boxes. The list at http://www.vagrantbox.es/ seems to still be being maintained. But I think I’ll start off by just downloading the 32 bit Ubuntu Precise Pangolin image from VagrantUp:

    $ vagrant box add precise32 http://files.vagrantup.com/precise32.box

I edited my edx/Vagrantfile to reference the precise32 image and then did ‘vagrant up’. It booted - pretty quickly. I can ssh in with ‘vagrant ssh’ and then turn the box back off with ‘vagrant halt’. That’s enough for now. Tomorrow, pick puppet or chef and create a working python environment.