Vagrant: build lightweight & portable dev environments

Vagrant is a tool for building complete development environments on┬áMac OS X, Windows, or a popular distribution of Linux. It helps you create and configure lightweight, reproducible, and portable development environments. With an easy-to-use workflow and focus on automation, Vagrant lowers development environment setup time, increases development/production parity, and makes the ‘works on my machine’ excuse a relic of the past.vagrant

$ vagrant init precise32
$ vagrant up

After running the above two commands, you’ll have a fully running virtual machine in VirtualBox running Ubuntu 12.04 LTS 32-bit. You can SSH into this machine with vagrant ssh, and when you’re done playing around, you can remove all traces of it with vagrant destroy.


mkdir vagrant
cd vagrant
sudo dpkg -i vagrant_1.4.3_x86_64.deb
vagrant init precise32
vagrant up

Drupal Vagrant
Go to Vagrant project page on and download the zip or tar file and extract it somewhere onto your filesystem (Example: ~/Documents/vagrant/).

  • First, make sure you have downloaded a Vagrant box
  • Go to the Vagrant project that you just downloaded (~/Documents/vagrant/) and create a public directory
$ cd [vagrant project]
$ mkdir public
$ vagrant up

Add this line to your /etc/hosts (or windows equivalent C:\Windows\System32\drivers\etc\hosts): drupal.vbox.local dev-site.vbox.local

That’s it, files in ‘public’ are served here: http://drupal.vbox.local/. If you get a Drupal error run http://drupal.vbox.local/install.php

One thought on “Vagrant: build lightweight & portable dev environments

Leave a Reply