Using Vagrant with WordPress
Hi, my name is Tina! I am a Full Stack Software Developer and Tech Lead from Canada. ππ»ββοΈ
Search for a command to run...
Hi, my name is Tina! I am a Full Stack Software Developer and Tech Lead from Canada. ππ»ββοΈ
No comments yet. Be the first to comment.
Have you ever installed a package by using go install <some-package> and wondered how to uninstall it? Go is really great in that respect. Go packages are a single binary and theyβre installed based on how your Go tooling is set up. Provided we have ...

Overview This is the 3rd article in a series of posts about working with Open API to create generated API clients and documentation websites. In the 1st post we went over what we can do with Open API spec files, e.g. generate API clients and documen...

Overview This article is the 2nd in a series of blog posts that discuss using Open API to help with API documentation and API client code generation. In the previous article, we went over how we can generate documentation and API clients using existi...

Overview This article starts a series of Open API-related blog posts. OpenAPI, previously known as Swagger (a name still in use today for many of its tools), is a suite of tools that generate documentation and networking clients for various programmi...

You've probably already seen the scary alert (that's possibly why you're here), but in case you haven't, it looks something like this: NewAppIJustDownloaded pasted from your clipboard Sometimes it h

Before beginning, you will need to have the following installed:
We will be using a tool called WPDistillery. This tooling uses ScotchBox, which is a pre-configured Vagrant box configuration that provides a LAMP stack setup for Vagrant. WPDistillery provides the WordPress application-related provisioning, while ScotchBox provides the LAMP stack infrastructure. Let's assume your project root directory is called my-website. We will clone the required files into our project directory:
git clone https://github.com/flurinduerst/WPDistillery.git my-website
This should clone a Vagrantfile and a ./wpdistillery directory into your project root. We will need to modify the file ./wpdistillery/config.yml. It's pretty much ready to go but we should change the database information from the default, which can be found in this section:
wpsettings:
url: wpdistillery.dev
# scotch box db access
db:
name: scotchbox
user: root
pass: root
prefix: wp_
Optionally, change the website URL from wpdistillery.dev to something more memorable, e.g. my-website.dev, and the database name from scotchbox to something more memorable for your website, e.g. mywebsitesdatabase. One of the benefits of doing this is the flexibility to run more than one WordPress website using ScotchBox on your computer. If all of your WordPress websites use the default database name, they will overwrite each other whenever you run them.
Once you've done this, run the following command:
vagrant up
This should start downloading the required Linux image if it has not already been downloading, and provisioning it with the ScotchBox configuration. Once the ScotchBox provisioning has run, it will start running the WordPress-specific commands that WPDistillery provides. At this point, if you've changed the default database name from scotchbox, this command should show an error saying that the provided database could not be found. This is to be expected. You should then at this point, log into the virtual machine and create this database:
vagrant ssh
mysql
create database mywebsitesdatabase;
Once that's done, you can Ctrl + D out of everything. You should be able to re-run the command and have it complete successfully.
Before loading your WordPress site in the browser, you will need to add the following line to your hosts file, found at /etc/hosts.
192.168.33.10 my-website.dev
Now that you've successfully provisioned a virtual machine that runs WordPress, you should be able to access it at the URL http://192.168.33.10 or http://my-website.dev/.
Your theme files are located at ./public/wp-content/themes/. You can create a new theme here and get started with developing your WordPress project.