In this tutorial I will go through how to setup a Vagrant install of WordPress on macOS along with highlighting some tools that will make running and managing a vagrant install a little easier than having to dive into terminal all the time after first installation. Once you have VVV up and running it offers a whole host of possibilities for quickly creating new WordPress installs for specific tasks which I will cover in some future articles.
1) Install VirtualBox
Firstly download a copy of VirtualBox and install this on your machine by following the installers instructions.
https://www.virtualbox.org/wiki/Downloads
2) Install Vagrant
Next you need to download and install Vagrant which you can do from below and again follow the installers instructions.
https://www.vagrantup.com/downloads.html
3) Install Vagrant Hosts Updater Plugin
Install the vagrant hosts updater plugin by typing this code below in terminal.
vagrant plugin install vagrant-hostsupdater
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: 192.168.50.4 vvv.dev local.wordpress.dev src.wordpress-develop.dev build.wordpress-develop.dev
4) Install Vagrant Triggers Plugin
Install the vagrant triggers plugin by typing this code below in terminal.
vagrant plugin install vagrant-triggers
5) Clone the VVV (Varying Vagrant Vagrants) to your machine
To get VVV (Varying Vagrant Vagrants) onto your machine which is what creates WordPress installs you can either clone this via Git ( Recommended ) or simply download the zip files from the github repo below to a directory you name vagrant-local on your computer.
git clone git://github.com/Varying-Vagrant-Vagrants/VVV.git vagrant-local
You can also use apps like Github Desktop or SourceTree to clone github repos.
https://github.com/Varying-Vagrant-Vagrants/VVV
For the purpose of this tutorial I placed my vagrant-local folder in my Applications directory but you can place this folder at any location on your machine.
6) Starting Vagrant for the first time
To start Vagrant for the first time we need to change directory so that we are inside the vagrant-local directory like this below.
cd /Applications/vagrant-local
When in that directory we then need to type this below in terminal.
vagrant up
Now sit back and relax for a little while as your new vagrant server is brought up with three default installs of WordPress to begin with.
Once your vagrant install is up and active you can access the default dashboard via this url below.
http://vvv.dev/
7) Install Vagrant Manager
The Vagrant Manager application allows you to manage all of your VM’s from one central location like this example below.
http://vagrantmanager.com/downloads/
8) Install VVV Dashboard
Clone or download the VVV Dashboard files from github into vagrant-local/www/default/dashboard/ folder.
Now move the file dashboard-custom.php from within vagrant-local/www/default/dashboard/ into vagrant-local/www/default/ instead.
9) Install Variable VVV – The Best VVV Site Wizard
vv makes it extremely easy to create a new WordPress site using Varying Vagrant Vagrants. vv supports site creation with many different options; site blueprints to set up all your plugins, themes, and more; deployments; and lots more features.
Firstly we need to install Homebrew on your machine which you can do by adding this text below to terminal.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Once Homebrew is installed copy this text below to terminal which will then install Variable VVV onto your machine.
brew install bradp/vv/vv
You can read more about how to create / provision new sites using VV from the github repository below.
You will now have a functioning install of Vagrant that you can start and halt easily from the Vagrant Manager application.
To further this post you may also want to read this follow up below with regards to a WooCommerce based VVV site provision.
Leave a Reply