

So, for example, you change sites/default/ in PHPStorm in your home OS, and Drupal in the VM will process the changes. In effect, this lets you work and edit files in your favorite IDE on your machine while the guest OS sees and uses the same files. If you haven’t used Vagrant before, shared folders map one or more directories from your host machine to paths on the virtual machine. This maps your project directory to /vagrant/ on the guest OS.

config.vm.network "private_network", ip: "192.168.33.10"įor this config, I’m just using the default shared folders setting. If you need your virtual machine to be accessible from other devices on your local network, look into using a public_network. Here, I’m using the private_network option, so the box and specifying an internal IP address. Next, we configure networking so that our box is accessible from the host OS. The line below tells vagrant to use a Debian 7.4 box that has chef installed (even though we won’t be using chef). There are boxes for CentOS, Redhat, and more. These are box images, many provided by the community, that have the base OS and some tools. First, we have to specify the box to build on. Let’s take a look at some key configuration settings.
DRUPAL VM HOW TO
It controls things like how to setup networking, map files between the host and guest OS, and run the provisioner we chose. The Vagrantfile describes the machine for a project and how to configure and provision it. At the end, we’ll just have to walk through the installation steps in a browser.
DRUPAL VM INSTALL
In this post, I’ll walk through setting up a Vagrantfile and shell script to install Apache, MySQL, PHP on a basic Debian machine automatically download and extract Drupal 8, and create a database for the site. How will your codebase run in PHP 5.6? Fire up a new machine and test it. Share your Vagrantfile and scripts with colleagues, so everyone works in an identical environment.Save your provisioning scripts in Version Control, to track how they change.Each site you work on gets its own machine, that you can destroy when the project is done.


Vagrant simplifies getting a working development environment running by automating the provision of a virtual machine for you, usually with a tool like Chef, Puppet, or Ansible. Installing MySQL can be a pain, system updates can change the version of PHP you’re running, and some PHP extensions are really difficult to build-even with Homebrew. I’ve never been able to easily run xAMP on non-Linux machines. However, I like using Vagrant to run my LAMP stacks, especially on OS X. I know there are other options, like Acquia’s own Dev Desktop, or even Zend Server. At this year’s php hackathon, I spent my time getting a Vagrant machine configured to run Drupal 8.
