Skip to content

Instantly share code, notes, and snippets.

@michalsen
Last active October 12, 2017 01:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michalsen/1312feabce910bd5848572014e84741a to your computer and use it in GitHub Desktop.
Save michalsen/1312feabce910bd5848572014e84741a to your computer and use it in GitHub Desktop.
Local Wordpress Development using Vagrant

Examples will be shown using MacOS and Vagrant virtual machine (https://www.vagrantup.com/). Windows developers can aslo refer to https://www.sitepoint.com/getting-started-vagrant-windows/ on getting Vagrant up and running.

Once Vagrant is installed, a Scotch Box virtual machine will be used.

Step by Step (5 minute install)

  • Move to your local directory where you would like your local development. For me it is ~/Sites
  • git clone https://github.com/scotch-io/scotch-box SITENAME (this installs the VM into the directory SITENAME)
  • cd SITENAME (go into directory)
  • vagrant up (start Vagrant)
  • vagrant ssh (log into the virtual machine that is now running)
  • cd /var/www/public (move to the web directory where Wordpress will be installed)
  • wp core download --version="4.8.1" (this downloads Wordpress version 4.8.1)
  • wp core config --dbname=scotchbox --dbuser=root --dbpass=root (this configures your Wordpress for the virtual machine)
  • edit your /etc/hosts file and add the line 192.168.33.10 SITENAME.dev (this allows your browser to find the Wordpress site you just installed)
  • edit the wp-config.php and add the lines (at the end)
    • define('WP_CACHE', false);
    • define('ENABLE_CACHE', false);
  • wp core install --url=SITENAME.dev --title=SITENAME --admin_user=admin --admin_email="admin@SITENAME.dev" (installs Wordpress)
  • wp cli update (updates Wordpress)
  • wp plugin update --all (updates plugins)
  • go to http://SITENAME.dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment