This is a guide to setup a new installation of WordPress + WP-CLI, running in an Ubuntu 22.04 Vagrant Box. Install Vagrant and Virtualbox before proceeding.
Clone Github repository to your local development machine:
git clone [email protected]:hamishau/vagrant.wordpress.git
Search for all instances of yourapp
and replace with your preferred project name.
vagrant up
Windows Powershell: notepad c:\Windows\System32\Drivers\etc\hosts
Ubuntu Terminal: sudo nano /etc/hosts
192.168.56.10 yourapp.local
http://yourapp.local:8080
These are not required as a part of the Vagrant deployment process - just a collection of helpful commands that might be required at some point in your Vagrant box.
vagrant ssh -c 'sudo wp cli update'
vagrant ssh -c 'cd /var/www && find ./html -type d -exec chmod 0755 {} \;'
vagrant ssh -c 'cd /var/www && find ./html -type f -exec chmod 0644 {} \;'
vagrant ssh -c 'cd /var/www && sudo chown -R www-data:www-data ./html'
vagrant ssh -c 'cd /var/www/html && sudo wp db export yourapp.sql --allow-root'
vagrant ssh -c 'cd /var/www/html && sudo wp db import yourapp.sql --allow-root'
vagrant ssh -c 'cd /var/www/html && wp db reset --yes'
vagrant reload
vagrant destroy