Our first vagrant box

Step 1: Create a simple development box with Vagrant

You can find the files, that are related to this workshop in the following git repository:


What is Vagrant?

Vagrant is a wrapper for diffrent virtualisation plattforms. A quite common one is VirtualBox. VirtualBox supports all common operating systems a host and as client operating systems.

Beside VirtualBox Vagrant supports also other virtualisation plattforms like VMWare Fusion.

What is Chef?

Chef is a tool to provision machines. The provisioning is done with recipes. These recipes follow a conventional structure and are written in ruby.

But don’t panic, the syntax is not to complicated. The advantage of chef is, that there is a huge set of common open source cookbooks, that can be used in your project.

A quite common cookbook for example is the apache cookbook. It can be used to configure the popular webserver apache.

Hello Vagrant

Before we can start, you need to download Vagrant and VirtualBox and install them on your system.

Vagrant can be downloaded here:



And VirtualBox can be downloaded here:


To provsion a simple server the following steps are needed:

mkdir step1
cd step1
vagrant init

Vagrant automatically creates a File „Vagrantfile“ that contains a very basic setup. You can read the comments in this file because it is very well documented.

Do install a very basic pure ubuntu server, we modify the Vagrantfile to contain the following:


# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "trusty64"
  config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
  config.vm.network :private_network, ip: ""

Start the Vagrant Box

When you have modified the Vagrantfile you can bring up your box with the following command:

vagrant up

Vagrant will now download the image and configure a virtual box with a ubuntu trusty image.

After the setup you can access this machine with the following command:

vagrant ssh

As you can see, it is quite simple to fire up a virtual machine, but by now we do not run any service on this machine.

To run a service, we can use chef as a „provisioner“ for Vagrant that will configure your VirtualBox.

In the next step we will use Chef as provisioner for VirtualBox run our own recipe