A WP-CLI package to set up a Multipass virtual machine (VM) and manage WordPress sites on the VM remotely from the macOS terminal.
curl -o- https://raw.githubusercontent.com/deliciousbrains/wp-cli-up/master/install.sh | bash
Once installation is complete, you should have a new Multipass VM called 'wp-cli-up' with the following software is installed:
- PHP 7.4
- Nginx
- MariaDB (root user password is 'root')
- Composer
- WP-CLI
- Redis
In addition, a root SSL certificate is generated and stored on your macOS keychain to allow the generation trusted SSL certificates for each site. You will find the root certificate in your ~/wp-cli-up folder.
Also in your ~/wp-cli-up folder, you will a sites folder, this is where your site files will be found.
Let's add our first site...
sudo wp up add --allow-root <domain>
The command needs to be run as root so the macOS /etc/hosts file can be updated.
Adding a site will generate a new SSL certificate, create a new Nginx configuration, create a new database and database user, and download and install WordPress.
sudo wp up remove --allow-root <domain>
The command needs to be run as root so the macOS /etc/hosts file can be updated.
Removing a site will remove all the SSL certificate files, Nginx confiugration files, database, database user, and site files.
multipass shell wp-cli-up
multipass delete wp-cli-up
multipass purge
wp package uninstall deliciousbrains/wp-cli-up
If you want to delete all your files as well:
rm -Rf ~/wp-cli-up