Multipass to fire up a Wordpress Dev Server
Another way to quickly fire up a local dev server for Wordpress development
Multipass Commands
multipass launch --name <the-name>
multipass start <the-name>
multipass stop <the-name>
multipass list
multipass delete <the-name>
multipass shell <the-name>
Wordpress(Apache2+Mysql)
sudo apt update
sudo apt install apache2 \
ghostscript \
libapache2-mod-php \
mysql-server \
php \
php-bcmath \
php-curl \
php-imagick \
php-intl \
php-json \
php-mbstring \
php-mysql \
php-xml \
php-zip
sudo mkdir -p /srv/www
sudo chown www-data: /srv/www
curl https://wordpress.org/latest.tar.gz | sudo -u www-data tar zx -C /srv/www
<VirtualHost *:80>
DocumentRoot /srv/www/wordpress
<Directory /srv/www/wordpress>
Options FollowSymLinks
AllowOverride Limit Options FileInfo
DirectoryIndex index.php
Require all granted
</Directory>
<Directory /srv/www/wordpress/wp-content>
Options FollowSymLinks
Require all granted
</Directory>
</VirtualHost>
Enable the site with:
sudo a2ensite wordpress
Enable URL rewriting with:
sudo a2enmod rewrite
Disable the default “It Works” site with:
sudo a2dissite 000-default
<VirtualHost *:80>
ServerName hostname.example.com
... # the rest of the VHost configuration
</VirtualHost>
Finally, reload apache2 to apply all these changes:
sudo service apache2 reload
sudo mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.7.20-0ubuntu0.16.04.1 (Ubuntu)
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> CREATE DATABASE wordpress;
Query OK, 1 row affected (0,00 sec)
mysql> CREATE USER wordpress@localhost IDENTIFIED BY '<your-password>';
Query OK, 1 row affected (0,00 sec)
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER ON wordpress.* TO wordpress@localhost;
Query OK, 1 row affected (0,00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 1 row affected (0,00 sec)
mysql> quit
Bye
Enable MySQL with sudo service mysql start
sudo -u www-data cp /srv/www/wordpress/wp-config-sample.php /srv/www/wordpress/wp-config.php
sudo -u www-data sed -i 's/database_name_here/wordpress/' /srv/www/wordpress/wp-config.php
sudo -u www-data sed -i 's/username_here/wordpress/' /srv/www/wordpress/wp-config.php
sudo -u www-data sed -i 's/password_here/<your-password>/' /srv/www/wordpress/wp-config.php
sudo -u www-data nano /srv/www/wordpress/wp-config.php
https://api.wordpress.org/secret-key/1.1/salt/
Shared Folder
multipass set local.privileged-mounts=1
multipass mount local/path/folder <the-name>:~/in/the/vm
socket error/command failed
restart windows