Vagrant CookBook cover page
Vagrant CookBook

Vagrant CookBook

A practical guide to Vagrant

Learn how to create effective Vagrant development environments
Vagrant CookBook Edit
This book is 100% complete


About the Book

Portable environments for effective development

How many times did you hear the excuse "works on my machine"? With Vagrant, this stays in the past. Your environments will be exactly the way you want them to be, targeting specific projects for different needs. As easy as cloning a repository and running "vagrant up".

This book covers from basic to advanced concepts on Vagrant, including important ProTips to improve your Vagrant projects and avoid common mistakes. The book was updated to cover the new features on Vagrant 1.5 and 1.6.


Vagrant Cookbook comes with quick guides to the 3 most used Vagrant provisioners: Puppet, Ansible and Chef. Following the guide, a practical example will show you how to provision a basic web server with Nginx + PHP5-FPM (PHP 5.5+). Choose the one you like best!

Recipes for most common tasks

The book also includes useful recipes for common tasks, writen in Ansible, Puppet and Chef.

Code Samples

The complete provisioner examples are available for free on GitHub.


Vagrant Cookbook targets beginner to intermediate users, also serving as a quick getting-started guide for Ansible, Puppet and Chef.


Thanks to the LeanPub platform, is really easy to release updates and notify my readers. Obviously at no extra cost. For any new content / corrections, you will be notified to download the newest version.


Any feedback that can help making this book better is highly appreciated. If you find errors, or if you have suggestions, please contact me.

Printed Version

If you prefer a printed version (paperback) rather than an ebook, you can get it here:

Read More

Table of Contents

  • Foreword
  • Preface
  • Acknowledgments
  • Introduction
    • What to expect from this book
    • Assumptions
  • Getting Started
    • How Vagrant Works
    • Terminology
    • Requirements
    • Installation
    • Updating Vagrant
    • Vagrant Commands
    • Your first Vagrant Up
  • The Vagrantfile
    • Basic Example
    • Defining the Box
    • Defining a Provisioner
    • Showing a post-up message (1.6+)
    • Setting up the Network
    • Setting up synchronized folders
    • VBoxManage Customizations
    • Quick Reference - Common Options
  • Provisioners
    • Overview
    • Getting Started with the Shell Provisioner
    • Automation Tools
    • Practical Example
  • Ansible
    • Overview
    • Quick Ansible Guide
    • Provisioning a PHP Web Server
  • Puppet
    • Overview
    • Quick Puppet Guide
    • Provisioning a PHP Web Server
  • Chef
    • Overview
    • Quick Chef Guide
    • Provisioning a PHP Web Server
  • Pro Tips
    • Update First!
    • NFS Performance Improvement
    • Permission Problems
    • Debugging
    • Login, Fix, Automate
    • VirtualBox Guest Additions
  • Advanced Topics
    • Running Multiple Virtual Machines
    • Provisioning VPSs on cloud services
    • Custom Boxes
  • Vagrant Share
    • Logging In
    • Sharing your Environment
    • Vagrant Connect
    • Securing your Shares
  • Recipes
    • System
    • Packages
    • Other
    • Conditional Execution
  • Appendix One: Vagrant Changelog
    • Vagrant 1.6
    • Vagrant 1.5

Read More

About the Author

Causes Supported

Electronic Frontier Foundation

Defending your civil liberties in a digital world.

Based in San Francisco, EFF is a donor-supported membership organization working to protect fundamental rights regardless of technology.

From the Internet to the iPod, technologies are transforming our society and empowering us as speakers, citizens, creators, and consumers. When our freedoms in the networked world come under attack, the Electronic Frontier Foundation (EFF) is the first line of defense. EFF broke new ground when it was founded in 1990—well before the Internet was on most people's radar—and continues to confront cutting-edge issues defending free speech, privacy, innovation, and consumer rights today. From the beginning, EFF has championed the public interest in every critical battle affecting digital rights.

The Leanpub Unconditional, No Risk, 100% Happiness Guarantee

Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks. We process the refunds manually, so they may take a few days to show up.
See full terms