Sunshine PHP 2017 -- Create Your Own Local Development Environments With Vagrant

Joe • January 26, 2017

vagrant

Excited to be heading back to Sunshine PHP 2017 in Miami. This year it's even better since the wife will be joining me again and her birthday is the first day of the conference. I'm not sure who made out better, me getting to go to a conference on my wife's birthday, or my wife getting a trip to Miami for her birthday? We'll call it a wash since it's going to be a great time for both of us.

This year I'm giving a tutorial "Create Your Own Local Development Environments With Vagrant". You may be thinking: "Why? isn't docker all the rage?" you're not wrong, however there are many out there who are still working on applications that aren't ready to be containerized just yet. Many people are still stuck using MAMP, WAMP, or some other similar tool. This tutorial is for them. People who have never used Vagrant or those who just want to understand how to build their own environment are the target audience for this tutorial.

Since this will be a hands on, follow along tutorial attendees will want to have some things pre-installed to make the most of the tutorial.

Operating System Support:

If you want to follow along and run all of the examples you will need to bring a laptop running a current version of Linux or Mac OS. Unfortunately Windows is unable to run Ansible so you will not be able to run any of the Ansible Playbooks.

Note: Despite Windows 10 Anniversary updating bringing BASH support to Windows, Ansible is still not yet supported.

Applications Installed:

Getting Started, Initial Downloads, and Set Up:

Install some vagrant base boxes. These files may take a few minutes to download, please make sure you run these commands BEFORE traveling to the conference

vagrant box add ubuntu/trusty64
vagrant box add ubuntu/xenial64
vagrant box add puphpet/ubuntu1604-x64
vagrant box add laravel/homestead

Testing Vagrant:

  • Create a new folder to hold your vagrant test
  • Change directory into that folder
  • Create a new Vagrant environment
  • Start the Vagrant
mkdir test-vagrant
cd test-vagrant
vagrant init ubuntu/xenial64

You should see the following output:

A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.

Screenshot:
Screenshot 2016-09-05 11.36.15
Now we can start the vagrant

vagrant up

You should see the following output:

Screenshot 2016-09-05 11.42.17

Once you have similar output to the above you can go a head and destroy the vagrant box to free up system resources. Your output may not exactly match the example. If there are any errors please feel free to leave me a comment below.

Destroy the vagrant machine:
Screenshot 2016-09-05 11.44.49