Setting Up Your Machine for Contributor Day

Getting Started

The basic requirement is to have a local web server on your machine that you can run WordPress on. There are a number of different ways to do that; MAMP, WAMP, XAMPP, etc. The problem with those solutions is that they can be difficult to set up, especially if you want to run more than one copy of WordPress. Another way to run a local web server is to install a virtual machine that runs independently of your desktop or Laptop OS. Again, there are a number of solutions, both free and paid. The solution we recommend is VirtualBox and Vagrant. This combination allows you to create virtual environment much closer to a real web server, and have it automatically set up everything, including WordPress, correctly for you. The full solution we recommend is one called Varying Vagrant Vagrants (VVV), originally developed by 10up and transitioned to a community organisation in 2014.

The following instructions, taken from the VVV Github page, apply to Windows, Mac, and Linux environments.

What is Vagrant?

Vagrant is a “tool for building and distributing development environments”. It works with virtualization software such as VirtualBox to provide a virtual machine that is sandboxed away from your local environment.

The First Vagrant Up

  1. Start with any operating system.
  2. Install VirtualBox 4.3.10
    • VVV is completely compatible with earlier versions of VirtualBox, so 4.2.22 or earlier would be just fine. Do note that Vagrant had specific issues with 4.2.16. Going as far back as 4.2.10 will likely be of no issue.
    • VVV itself leans in the 4.3.x direction in the master branch to stay ahead of the curve.
  3. Install Vagrant 1.5.4
    • vagrant will now be available as a command in your terminal, try it out.
    • Note: If Vagrant is already installed, use vagrant -v to check the version. You may want to consider upgrading if a much older version is in use.
    • Note: If VirtualBox 4.3.x is installed, Vagrant 1.3.5 or later is required.
  4. Install the vagrant-hostsupdater plugin with vagrant plugin install vagrant-hostsupdater
    • Note: This step is not a requirement, though it does make the process of starting up a virtual machine nicer by automating the entries needed in your local machine’s hosts file to access the provisioned VVV domains in your browser.
    • If you choose not to install this plugin, a manual entry should be added to your local hosts file that looks like this:
    • Note that you may need to make the hosts file writable by the user you run Vagrant as for the hosts updater to work without requiring a password.
  5. Install the vagrant-triggers plugin with vagrant plugin install vagrant-triggers
    • Note: This step is not a requirement. It does allow for various scripts to fire when issuing commands such as vagrant halt and vagrant destroy.
    • By default, if vagrant-triggers is installed, a db_backup script will run on halt, suspend, and destroy that backs up each database to a dbname.sql file in the {vvv}/database/backups/ directory. These will then be imported automatically if starting from scratch. Custom scripts can be added to override this default behavior.
  6. Clone or extract the Varying Vagrant Vagrants project into a local directory
    • git clone git:// vagrant-local
    • OR download and extract the repository master zip file
    • OR grab a stable release if you’d like some extra comfort.
  7. Change into the new directory with cd vagrant-local
  8. Start the Vagrant environment with vagrant up
    • Be patient as the magic happens. This could take a while on the first run as your local machine downloads the required files.
    • Watch as the script ends, as an administrator or su password may be required to properly modify the hosts file on your local machine.
  9. Visit any of the following default sites in your browser:

Fancy, yeah?

2 thoughts on “Setting Up Your Machine for Contributor Day

Comments are closed.