With WordPress 5.2 I decided to leave my CentOS 7 installation as it required PHP 5.6.20 or higher and my CentOS only had 5.4.16. Yes, I could have manually upgraded PHP from alternative CentOS repositories but I decided not to. While CentOS has been stable for me and I had pretty much no issues with it, that stability came at the cost of slow or non-existent new features. Biggest example being stuck in pre-HTTP2 times.
It took me a while to decide which distribution to use as a replacement, the final candidates being Debian and Ubuntu. While I was really tempted to go with Debian due to its reputation, I decided to go with Ubuntu at the end. It was due to frequency of updates more than anything else. After sticking with CentOS for so long, I wanted something more dynamic.
Most of my setup scripts needed just a simple replacement of yum
with apt-get
, the only major hurdle presented switching from CentOS Apache (httpd) to Ubuntu's Apache (apache2). Despite both being 2.4, differences were significant enough that I couldn't just move my config files. So I went with true and tested way of gradually modifying my config file until I could actually start Apache.
The first hurdle was how to install it. My CentOS installation used httpd
mod_ssl
php
php-mysql
, and php-gd
packages. The equivalent Ubuntu setup consisted of apache2
php
php-mysql
php-gd
. Essentially only the SSL package was missing from list and only because Apache2 already contained it.
The first error appeared with User and Group setting. While CentOS uses apache
, the Ubuntu needs www-data
. Remember that you need to change this not only in config file but that a chown
or two might be needed.
The biggest issue were includes. On CentOS I used the following collections:
Include conf.modules.d/00-base.conf
Include conf.modules.d/00-mpm.conf
Include conf.modules.d/00-ssl.conf
Include conf.modules.d/00-systemd.conf
Include conf.modules.d/10-php.conf
On Ubuntu there is no equivalent. One has to either use wildcards to load all or list each include separately. Since list of enabled modules is rather conservative, I decided to use wildcards:
Include mods-enabled/*.load
Include mods-enabled/*.conf
Include conf-enabled/*.conf
Due to aforementioned conservative list of enabled modules, I had to enable a few more:
Terminala2enmod autoindex
a2enmod expires
a2enmod headers
a2enmod rewrite
a2enmod ssl
a2enmod socache_shmcb
a2enmod php7.2
And yes, this is not strictly speaking equivalent of CentOS configuration but it's close enough for my WordPress installation. Depending on your exact setup, you might need to enable a few more (or choose to skip some).
The last change I had to do was for firewall. As Ubuntu uses ufw
, the following commands were needed to allow traffic through:
Terminalufw allow 'Apache'
ufw allow 'Apache Secure'
sudo ufw reload
And now my WordPress runs on Ubuntu. :)