Having a dedicated development instance to start working on means I can prepare an initial update to the site entirely offline where mistakes won't show and I can't do any permanent damage. Joomla runs on a LAMP stack, so since I have a home lab, creating a VM seems a logical starting point.
Specification
This is not a demanding application, so a small VM with 1 vCPU and 1GB of RAM is more than sufficient. Disk space is also minimal, based on the sandpit an 8GB boot disk and 2GB for data will also be enough. And the advantage of a virtualised environment is it's easy to scale up if needed.
VM Build
My home lab is based on the free VMware ESXi 7 hypervisor running on a somewhat over-specified Dell server thanks to a combination of magic smoke escaping the NIC of the previous server and an interesting career opportunity that didn't quite launch as expected. See the Geeklab series (when published!) for more on this.
| Item | Value |
| Compatibility | ESXi 7.0 U2 |
| VM Name | P_JoomlaCube-Dev |
| OS Family | Ubuntu Linux (64-bit) |
| vCPU | 1 |
| RAM | 1024 MB |
| Disks | 16 GB, 2GB, 2GB |
| SCSI | VMware Paravirtual |
| Network 1 | VMXNET 3 |
A CD-ROM is also defined for the initial installation, connecting to the OS .iso file on one of the datastores.
Disks
| Device | Format | Filesystem | Size |
| /dev/sda1 | bios_grub | 1.0 MB | |
| /dev/sda2 | ext4 | /boot | 512 MB |
| /dev/sda3 | btrfs | / | 7.497 GB |
| /dev/sdb1 | swap | 1.998 GB | |
| /dev/sdc1 | btrfs |
/srv/joomla = @joomla-srv /var/lib/mysql/joomladb = @joomla-db |
2 G |
This is pretty much a standard pattern for my lab Linux VMs. The first disk is the system disk and holds a bios_grub partition which is created by default and as a matter of habit I create a dedicated /boot partition to protect against being unable to boot should something interesting happening and the root partition fills completely. The second disk is a dedicated swap partition since that's apparently quicker than a swap file and it also makes it really easy to resize if needed.
While this installation isn't really big enough to need it, application data is on the remaining disks. Again this is more of a habit and a pattern I use in my real life and unlike some of the cloud providers I don't have a limit on the number of disks I can attach to small VMs. The idea here is to move application data off the system disk to make it easier to move around if ever needed. This is also a bit of an experiment too as the btrfs filesystem performance can be a bit problematic with databases and as it turns out MariaDB has its own issues with this approach anyway.
OS Build
I used Ubuntu Server 20.04 LTS for this as although it's starting to age a little it's still in mainsteam support for another 2 years. The disk build was custom, with the /dev/sdc1 device formatted to btrfs but left unmounted since the installer doesn't handle that well.
The only other options selected were to set localisation to English(UK) and to install OpenSSH server. I don't install any of the recommended snaps and as soon as install is complete I stop the application of security patches as I'll apply them at the end of the build so the next step should always start from a known-good state.
I have two Ansible playbooks I use do to initial OS configuration which complete about 2 hours of manual work in about 2 minutes, including signed SSH host certificates and user CA and deploying a Bacula client with the base OS backup config. And yes, this will all be the subject of future articles too.
The final build step is to complete the OS backup configuration using the templates prepared by the Ansible playbooks and take an initial OS backup just to be sure it works. Additional application-specific backup configuration is needed once the installation is completed.
Application Preparation
The next step after Linux install is prepare the rest of the LAMP stack - Apache2, MariaDB and PHP. All taken from the standard Ubuntu repositories for simplicity at this point. Even if they're not the latest versions any more, they're still sufficient for a development Joomla.
Apache 2
Install the standard version with:
sudo apt install apache2
ToDo: An internal TLS certificate will be needed to enable HTTPS.
MariaDB
This is also available as standard:
sudo apt install mariadb-server
As the root user run the mysql_secure_installation script to set some sensible defaults.
Current root = [enter for none]
Set root password = y
New password = [**MySecretPassword**]
Remove anonymous user = y
Disallow root login remotely = y
Remote test database and access to it = y
Reload privilege tables now = y
I also create a backup user at this point ready for use with a backup script configured later. Still as the root user:
root#> mysqlCREATE USER '[backupuser]'@'localhost' IDENTIFIED BY '[**password**]';GRANT SELECT, SHOW VIEW, LOCK TABLES, RELOAD, REPLICATION CLIENT ON *.* TO '[backupuser]'@'localhost';FLUSH PRIVILEGES;
Replace [backupuser] and [**password**] with appropriate values of your own choosing.
Note: I've left CoW enabled for the MariaDB files in /var/lib/mysql as it doesn't seem to be affecting performance. But it really impacted a Nextcloud server I build to I'm going to keep an eye on this.
PHP
The version in the standard repos is 7.4 which is now out of support and will give a warning from Joomla. This isn't an immediate issue for this server, but it is something I need to look at fixing for the longer term.
sudo apt install php
Following recommendations elsewhere I also added some more modules. Given some of the other info was wrong I'm not going to vouch for any of this right now apart from the fact I did get Joomla working with them.
sudo apt install php-mysql
php-mbstring php-intl php-xml php-gd php-zip php-curl php-xmlrpc
Initial Backup
At this point it's a good idea to take another OS backup, and if not done so already apply outstanding Ubuntu patches. Since this is a VM we can also take a VM snapshot from the ESXi console for rapid recovery should something interesting happen.