Chapter 3. Provisioning Your Vagrant VM

According to The Tao of Vagrant, a developer can simply run vagrant up and have a complete development environment ready to go. This means that all the necessary software for each project being developed should be installed on the guest. This can be done one of two ways: baking the software into the box itself, or automatically installing the software as part of the development environment creation process. Provisioning does the latter.

In practice, the base boxes used by Vagrant are usually quite bare. The base box this book has been using in examples so far is a bare-bones Ubuntu 12.04 LTS installation. Only the minimal amount of software required to make it function with Vagrant (e.g., SSH) is installed.

The problem of installing software on a booted system is known as provisioning, and is often the job of shell scripts, configuration management systems, or manual command-line entry.

Vagrant supports automated provisioning, and will run configured provisioners on every vagrant up so that the necessary software and configurations needed to run the project being developed in the Vagrant environment are all properly prepared.

Out of the box, Vagrant supports provisioning with shell scripts, Chef, or Puppet. Additional provisioners can be added via plug-ins if your organization requires it.

In this chapter, we’ll set up Apache to serve static files from the Vagrant shared folder. In the previous chapter, we did this by manually running Python’s ...

Get Vagrant: Up and Running now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.