Installing Vagrant on Ubuntu

A headless virtual development environment that can easily be shared.

Today I first encountered Vagrant through a yeoman generator of all things. I have but touched on it, but what I’ve seen as of yet I like.

Installation

Before I look closer at what can be done with it, there’s the quick “gotcha” that, if you are not careful, will, erh… Get you.
First, download the latest version from their downloads page. After that, resist trying to install it using Ubuntu Software Center, there is a known issue with how several things interact, with the summary being that installing Vagrant from Ubuntu Software Center will uninstall virtualbox-4.2 if you have it installed.

How do we solve that?

Easy, actually. Rather than using apt-get to install the package and all its’ dependencies, use dpkg -i <vagrant-file> instead to install only the package, to hell with any of its’ dependencies.

Installing VirtualBox

If you didn’t have VirtualBox, the best plan is to go to Oracle’s Download page and download the latest version of VirtualBox. After that, you can either double-click on it to open up Ubuntu Software Center, or run dpkg -i <name-of-package.

Usage

Vagrant’s documentation is quite well written, with the Quickstart particularly useful, but here’s some highlights:
* vagrant init — Creates a Vagrantfile in the directory with basic settings. If called with a name and an url to a box, it will install that box, ex: vagrant init precise32 http://files.vagrantup.com/precise32.box, which creates a box called precise32.
* vagrant up — Starts the machine based on the configurations in the Vagrantfile
* vagrant ssh — Logs into the virtual machine using SSH
* vagrant destroy — Tears down the machine and any changes done to it

Future installations in this serie will cover the configuration I use, but that requires I start by getting the configuration to work!


For the moment comments are not enabled, but feel free to reach out on Twitter.