In order to get started with any WordPress development on your computer you will need to have a local development environment setup. Here’s a handy guide in getting this done quickly and easily.
There are a number of different ways to get things working: MAMP, WAMP, XAMPP, etc., but the solution we recommend is VirtualBox and Vagrant as it is the easiest to use and keep updated. This combination allows you to create virtual environment that is similar 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 virtualisation software such as VirtualBox to provide a virtual machine that is sandboxed away from your local environment.
The First Vagrant Up
- Start with any local operating system such as Mac OS X, Linux, or Windows.
- Install VirtualBox 4.3.x
- Install Vagrant 1.6.x
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.
- Install the vagrant-hostsupdater plugin with
vagrant plugin install vagrant-hostsupdater
- Install the vagrant-triggers plugin with
vagrant plugin install vagrant-triggers
- Clone or extract the Varying Vagrant Vagrants project into a local directory
git clone git://github.com/Varying-Vagrant-Vagrants/VVV.git vagrant-local
- OR download and extract the repository master zip file
- OR grab a stable release if you’d like some extra comfort.
- In a command prompt, change into the new directory with
cd vagrant-local
- 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 – on a standard ADSL line in South Africa this could take a a couple of hours as there is a lot to download.
- Watch the script as it ends because an administrator or
su
password may be required to properly modify the hosts file on your local machine.
- Visit any of the following default sites in your browser:
- http://local.wordpress.dev/ for WordPress stable
- http://local.wordpress-trunk.dev/ for WordPress trunk
- http://src.wordpress-develop.dev/ for trunk WordPress development files
- http://build.wordpress-develop.dev/ for the version of those development files built with Grunt
- http://vvv.dev/ for a default dashboard containing several useful tools
- Profit.
Check out the Varying Vagrant Vagrants project on GitHub for more info.