Vagrant allows you to create portable work environments which can be easily reproduced on any system. It's useful for developers and system administrators who want to mimic a server's configuration on their local machine. It's useful for teams who want to quickly get designers and project managers up and running with a local installation.
Note: another common tool for creating development environments today is Docker, which is becoming very popular with Drupal (and other) developers. Take a look at our Drupal Development with Docker series to learn more.
Vagrant is a wrapper which ties together several components including: virtualization software, such as VirtualBox; a server base box, such as Ubuntu provisioning tools for configuration management, such as Chef.
We start the series with a brief overview of what Vagrant is, and what the hardware limitations are for using Vagrant. No sense proceeding if your machine isn't up to the job! With the pre-requisites out of the way, we'll go through the steps to install Vagrant and the virtualization software, VirtualBox.
For these lessons, you'll be creating an Ubuntu server on your host machine. Once your server is installed, we'll SSH into the server, and install Apache, MySQL, and PHP (creating a LAMP stack). There are a couple of "extra" lessons relevant to these beginning steps. There's an "extra" lesson covering SSH for Windows users and also one on updating Vagrant, if you've previously installed it and are having problems getting things up and running for these lessons.
Once your virtual server is setup we now need to connect to the server. We will setup connections so that you can access your virtual server's Web pages in a browser; and then we will setup file sharing so that files appearing on your host machine will also automatically be available to your virtual server. This will allow you to continue using your favorite local code editing tool.
Although you can configure your server manually, anything that's configured by hand leaves room for error. So the next thing we'll do is learn about configuration management software, such as Puppet, Chef, and Ansible. We're going to focus on the basics of Chef for this learning series (Emma will talk about why she chose Chef in the lesson).
Finally we'll talk about some strategies of how to use Vagrant for your particular workflows. Emma will also give you a bonus lesson of how to install Drupal using Drush. We cover Drush in more depth in Introduction to Drush.
The support files for this learning series are available from GitHub, and as individual downloads per lesson.
These lessons build on one-another. Completing these lessons in order will provide you with the best learning experience.
Note: The videos were recorded using Vagrant 1.4.3, and VirtualBox 4.3.6. Known issues are outlined in each of the relevant lessons. If you find an issue, please let us know from the video page where you found the issue.
The major objectives for this series are as follows. By the end of this series you should be able to:
- Describe the advantages, and disadvantages for creating a local development environment with Vagrant.
- Log into your virtual machine, and use the command line to install new software.
- Correctly configure your host's network settings to make the virtual machine available via a browser.
- Share files between your host and guest machines without the use of SCP.
- Install Vagrant and VirtualBox on a host platform of OSX, or Windows; and create and destroy a Vagrant instance.
- Explain how configuration management relates to virtual machines, and why you would want to provision new virtual machines.
- Add a Chef recipe to your configuration, and re-provision Vagrant.
These lessons are geared toward the following roles:
- Developer (novice, or new to system administration with virtualization)
- Site builder (intermediate)
- Technical project manager (intermediate - advanced)
- System administrator (novice, or new to system administration with virtualization)