Using Vagrant as a WordPress Development Environment: Part 2

In my previous post, I discussed installing and setting up Vagrant with a basic Ubuntu box and troubleshooting a snag I hit having Hyper-V activated. In this post, I’ll troubleshoot another Vagrant setup issue and adding Scotch Box, a Vagrant box designed for LAMP applications (including WordPress).

A Second Hiccup

After resolving the Hyper-V issue, I encountered another error after running “vagrant up”: the connection between Vagrant and VirtualBox timed out. Opening the VirtualBox GUI preview window showed a blank, black screen. Not very helpful.

Opening the VirtualBox “settings” screen, however, showed that my box was configured to use a very low amount of RAM. I upped this to 1024MB and re-ran “vagrant up” without any issues. The box booted successfully.

Important Configuration Settings

This all could have been avoided had the Vagrant quick start tutorial made note of two important settings within the “Vagrantfile”. On line 46, the following lines are commented out:

# config.vm.provider "virtualbox" do |vb|
#   # Display the VirtualBox GUI when booting the machine
#   vb.gui = true
#
#   # Customize the amount of memory on the VM:
#   vb.memory = "1024"
# end

Un-commenting those lines would have saved me an hour or so of frustration, giving the box the necessary RAM to boot and also allowing me to see the box as it boots, instead of only reading messages within the console.

A Vagrant Box for WordPress: Scotch Box

The last real steps of the Vagrant quick start tutorial call for SSH-ing into the fully booted box. I was happy just being able to boot the machine after a couple hours of tinkering, so I decided to save the SSH step for when I had a box I’d actually be using for development.

Some searching led me to Scotch Box, a complete LAMP stack solution for Vagrant that required little configuration after installation. I tried a couple other “WordPress” tagged boxes from the catalog, but none seemed ready-to-go, uhh, out-of-the-box.

There appears to be both a difficult way and an easy way to get Scotch Box up and running. Of course, I inadvertently chose the difficult route. Following the Vagrant instructions, I initialized my project directory and added the box from the catalog. After modifying my “Vagrantfile” to make sure I had enough RAM, I ran “vagrant up” and ran into another timeout issue, followed by a chain of other problems.

As it turns out, all of my troubles could have been avoided if I had simply cloned the Scotch Box repository on Github. Doing so would have given me a properly configured “Vagrantfile” and allowed the box to launch with the web-server accessible from my host machine.

In the next part of this series, I’ll SSH into Scotch Box, connect to the MySQL database and install WordPress using Yeoman.

Leave a Reply