Hybrid Hacker

👾 Technical notes and hybrid geekeries

WordPress development environment with Vagrant and Ansible

Some days ago I had the need of playing with a WordPress website on my local environment. There are many solutions out there to build your local WordPress environment, but I remembered an old project I've created some years ago. And yes, it's still working out of the box!

I called it One Command WordPress, cause it makes use of Vagrant and as you may know you only need one command to fire up your env: vagrant up.

One Command WordPress creates a virtual machine through Vagrant/Virtualbox and installs all the environment packages using Ansible:

  • Ubuntu precise64 (should work with other Ubuntu versions)
  • Nginx
  • Php5-fpm
  • Mysql
  • WordPress
  • Various system software (likve Vim and Git)

Another cool thing about One Command WordPress, is the possibility of writing directly on your webroot. If you look on your host, you can find a folder called wordpress.dev and this is where your WordPress installation lives. Using Vagrant BindFS plugin we solve all the permission issue that usually happen with NFS mount.

To install One Command WordPress, first of all be sure to meet all the requirements installing this software:

Next, clone the repo and do a vagrant up after configuring ansible/group_vars/all:

git clone https://github.com/nballotta/one-command-wordpress.git
cd one-command-wordpress    
vagrant up

You will find your WordPress installation under wordpress.dev/ and you can point your browser to http://wordpress.dev.