Close

September 15, 2020

Spin-up Fast Local WordPress Development Instances using Ubuntu Multipass

We do a significant amount of development on WordPress sites and spinning up new instances for local development work has always been a chore. We are late to the party, but we’ve recently standardized on Ubuntu’s fantastic free system called Multipass .

Essentially on our Windows 10 Pro workstations, multipass allows us to quickly spin up brand new Ubuntu server instances with just a single command line.

multipass launch –n yourname

Its a no fuss system and completely meant to be wide open for quick local development, so most of the firewall restrictions are turned off.

Also, you can quickly “Mount” your local code folder into the /var/www/html folder of the new ubuntu instance and have an instance local development environment.

The only tricky thing we have found is that the ubuntu instance is very vanilla. We wish they would build a LAMP version that has all the services necessary for WordPress, right out of the box.

We’ve put together a script that automates the process, but there are still a few manual things you need to modify. The whole spin-up process takes about 5-6 minutes tops, not including the package installation.


Install Services:

apt-get update
sudo apt install mysql-server
sudo apt install apache2
sudo apt install php libapache2-mod-php php-mysql
sudo apt-get install -y php-simplexml
sudo a2enmod rewrite
sudo apt-get install php-mbstring
nano /etc/apache2/apache2.conf #(Fix AllowOverride ALL).
/etc/init.d/apache2 restart

Configure MySQL

nano /etc/mysql/mysql.conf.d/mysqld.cnf
Change “bind-address = ip address”. The “ip address” should be the local address of the ubuntu instance.

Enter into MYSQL and create a global user.

GRANT ALL PRIVILEGES ON *.* to ‘generic’@’%’;

restart MYSQL
/etc/init.d/mysql restart

Mount your drive:

Back in your cmd window, mount your local folder to your new ubuntu instance.

multipass mount e:\web\customerhtml adaptable-mink:/tmp

We are sure there are ways of completely automating the process, but for our purposes this works perfectly.