Using Salt Stack and Vagrant for Drupal Development

Get the Base Box

Get the base box from You'll need a box in which to create and run your environment. Boxes are what Vagrant uses for your virtual machines, and they are simply virtual machines that have been configured specifically with Vagrant support. You can create your own from scratch, but it is much quicker and easier just to download a pre-made one that has all of the necessary Vagrant configurations already set up. I used the precise64 box. This is an Ubuntu 12.04 64-bit Linux server with the necessary Vagrant tools and guest additions already in place. You're downloading an entire operating system, so be patient, because it might take a little while. It usually is best to download your box and then save it locally somewhere so you can use it again.

If you're using a 32-bit host operating system, you should instead download the 32-bit version.

Import the Box

Hopefully by this point, you have everything you need. Let's use the command line to interact with Vagrant and import your new box.

To import your box, use:

vagrant box add precise64 /path/to/your/downloaded/box

Relative path names don't work well here, so if you downloaded your box to your home directory, you need to type out the full path—for example, ~/bhosmer/ should be typed out like this: /home/bhosmer/

The vagrant box add command creates a copy of your box and stores it so that Vagrant can access it. This box is used to create the instantiation of the particular box you happen to be using. The nice part is that you always can press the "reset" button by using vagrant destroy to delete anything you've done and set it back to its original state before you started. I go into that in more detail a little later.

Launch the Box and Verify the Guest Additions

Now, launch your box just to make sure that the VirtualBox guest additions are up to date. If they aren't, Salty-Vagrant may not work properly.

Where you store your Vagrant configurations is entirely up to you. I like to keep mine in my home directory under a vagrant folder, just so I can keep track of the different environments I have.

Create a new directory called salty-vagrant and cd into that directory.

Now use vagrant init to initialize a Vagrantfile there. This is a standard Vagrant configuration file that is well documented. You won't need to change any of the configurations, except for line 10: = "base"

If you followed the quick-start instructions from, Vagrant specifies your default boxes as base. Change this to the name of the box you imported, precise64: = "precise64"

Notice that I left the .box extension off.

Now that your Vagrantfile points to the correct box, use vagrant up to start your virtual machine.

If you get a warning that your guest additions are out of date, and it is quite likely that you will if you just installed VirtualBox, proceed to the next step. If you didn't, you can skip to the section "Add a Salty-Vagrant Vagrantfile".

Updating the Guest Additions

If you do need to update the guest additions installed on your box, in this section, I explain how to do it on the Ubuntu-based box you just downloaded. This will be one of the few times that your changes will be permanent within a box. And this time, you want them to be. The guest additions allow your host operating system to interact with the guest operating system. This includes sharing files and network resources between them. You store your configuration files on your host operating system, and then they are copied to the guest operating system when you start it up each time, so it is important that the shared-folder functionality works.

After Vagrant finishes booting the guest operating system, you'll need to connect to this box using SSH. Use the Vagrant-supplied command: vagrant ssh.

You then will be logged in to the guest operating system as the "vagrant" user.

Updating the guest additions probably is the trickiest and most-involved task. If you run into any problems, lots of resources are available on-line. Most distributions mention a number of solutions in their respective forums, and the VirtualBox Manual ( also has some detailed information. I'm going to show you how to download and update the virtualbox guest additions from, and update them on the precise64 box that you just downloaded as an example.

First, you need some packages to build and compile the Linux kernel. Use Ubuntu's package manager, apt, to install them:

sudo apt-get install dkms linux-headers-3.2.0-23-generic

If you're using a non-Debian machine, search for the proper names in your particular package manager and use the header version that matches your particular kernel.

With kernel support now in place, browse to and locate the folder that matches the version of VirtualBox that you have installed. Generally, you can find what version you have through the VirtualBox graphical interface or the warning message generated by Vagrant when you booted your virtual machine. Now, locate the VBoxGuestAdditions_x.x.x.iso that also matches the version of Virtualbox that you have installed. Replace the x in the filename with the specific version for your version of VirtualBox.

You can copy the URL to this file and paste it into the terminal window of your guest Ubuntu system that you had previously SSH'd into. Use wget to download the ISO:


Again, replace the x in the filename with the version that matches your VirtualBox installation.

You now should have an .iso file in your home directory.

After it's downloaded, mount it so that you can access the files contained in it by first creating a temporary directory in which to mount this .iso. Within your home directory, use this command:

mkdir -p tmp/vbox

Now, mount the .iso into that folder:

sudo mount -o loop VBoxGuestAdditions_x.x.x.iso tmp/vbox/

Within the .iso, you'll find a script. Copy this to your home directory:

cp ~

Now, make it executable by adding the execute flag:

chmod +x

And finally, run the installation script:

sudo ./

If you get a warning about failing to install the window system drivers, you safely can ignore it. The box you are installing these guest additions on is a server and doesn't have a window manager installed. You also can use the --nox11 flag like this when you install the updated guest additions:

sudo ./ --nox11

The last step in this installation is to reboot the machine to ensure that the guest additions are up to date with:

sudo reboot

After the box restarts, log back in with:

vagrant ssh

Now you can unmount the .iso using sudo umount /mnt, if it isn't already, and delete the and the .iso file to save space. You also optionally can do some housekeeping by deleting the .bash_history file.


Ben Hosmer is a DEVOP with RadiantBlue Technologies where he develops and maintains Drupal sites and administers various servers. He is an open-source advocate and helps spread the use of Linux and other open-source software within the US government.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Network type VM setting should be updated...

Cruz's picture

Thanks for the great tutorial!!

I'm currently using Vagrant version 1.2.4 and it did not like the "hostonly" Network type: Network type 'hostonly' is invalid. Please use a valid network type.

I looked up the online Vagrant docs and found that the correct Network type is: "private_network"

The above VM setting should change...
From: :hostonly, ""
To: :private_network, ""

Thanks again!!


Anonymous's picture

I am very happy to discover this particular post very beneficial personally, as it includes lots of details. I choose to browse the quality articles which issue I ran across in your soul post. Appreciate your expressing!
Learn 2 Backlinks for Seo

Everything is well designed

zeennate's picture

Everything is well designed your site and very nice with many choices, it is a wonder! Congratulations. friendly
voyance gratuitement

use Vagrant

Propeople's picture

Also check out this article about how Vagrant can help you simplify a complex development environment.

Question about a step

Bruno Barrette's picture


First of all, thanks for the article... Currently trying to set this up for some testing, it looks more than interesting.

I have a question though for something that seems to be missing some informaiton...

In the step "Add a Salty-Vagrant-Specific Vagrantfile":

When you're talking about deleting the vagrantfile we already have, just to make sure, you're talking about the one in the salty-vagrant folder, right?

Afterwards, you are redirecting us to take the Vagrantfile from the given URL... What Vagrantfile config should we take? There is a sample one on that page, that doesn't seem to reflect the next directions you give in this tutorial (there is no minion_conf line in this example). There is also one in the exemple folder, should it be this one?

I am up to this point now, hopefully you can provide a clarification on this step.

Thanks in advance,

Reply to comment | Linux Journal

aesthetic dentistry nyc's picture

My family always say that I am killing my time here at net, but I know I am getting knowledge all the time
by reading such nice articles or reviews.

Reply to comment | Linux Journal's picture

Amazing! This blog looks exactly like my old one! It's on a completely different subject but it has pretty much the same layout and design. Wonderful choice of colors!

Have you tried Boxen? It's a

Adam Gerthel's picture

Have you tried Boxen? It's a dev toolkit made by Github in order to easily set up dev environments, and it uses Puppet. It solves the same problem in a way that Vagrant does, but made for OSX.

Please correct the URL for Salt Stack's web site

Anonymous's picture

The article text has a URL for Salt Stack with a typo. Please change it to and delete this comment.

Automatically updating Guest Additions

Bert VV's picture

Nice article, thanks for sharing. Especially the part about Salt is interesting.

There's a Vagrant plugin that can automatically update VirtualBox Guest Additions:

Every time you boot a box, it checks the version and updates when necessary.


Reply to comment | Linux Journal

what to say to beautiful women's picture

Great article! We are linking to this particularly great post on our site.
Keep up the great writing.

Reply to comment | Linux Journal

Samantha's picture

I'm not sure why but this site is loading extremely slow for me. Is anyone else having this issue or is it a issue on my end? I'll check back lateг
аnd sеe if the pгoblem ѕtill ехists.