Ubuntu 18.04 LTS has been released for several months now, with the first point release update 18.04.1 arriving in late July. Users wanting to use the prescribed upgrade mechanism from an older Ubuntu LTS release had to wait till this point release update. Here’s my Ubuntu 18.04 LTS upgrade notes, coming from the previous 16.04 LTS release.
I am writing this with my blog website as reference. You can read my Making Of A Techie’s WordPress Site post for some background on the build components of this website, as well as my Apache, HTTP/2 and PageSpeed on Ubuntu pre-16.04 post for some build nodes. They will establish some context about what I’m upgrading from.
Notably, I had been running a version of Apache 2 from Ondrej Sury’s PPA. The main reason for that is my want for HTTP/2 support via Apache mod_http2 which, at that time, Ubuntu considered to be experimental and did not build that into their release repository. With Ubuntu 18.04, I established that mod_http2 is now included, and I prefer not to depend on a third party repository (no offence to Ondrej).
I want to return to Ubuntu’s own Apache 2 packages, but the downside is that their version is slightly older: Apache 2.4.29 vs Ondrej’s 2.4.34. It’s no big deal. I’ll still go with stock Apache 2 from Ubuntu 18.04. There is another issue; I’ll get into that later.
Ubuntu, unlike CentOS, has a very elegant, convenient, way to upgrade from release to release. The
do-release-upgrade command does all the magic, including starting up SSH server on an alternate part as a backup remote access method in case the main SSH service breaks. Start the upgrade by simply running:
Follow the on-screen instructions. Remember to read and digest the information properly before just hitting “next” or going with the suggested default action. Where applicable, I suggest that you keep locally modified configuration whenever Ubuntu detects a conflict with default configurations from the package. It should be fine to remove old, outdated, packages.
The actual upgrade is pretty quick if you have a good Internet connection. Mine was done in about 15 minutes.
Then, let’s switch Apache 2 back into the stock distribution version using
ppa-purge to remove Ondrej’s repository.
$ apt install ppa-purge # ppa-purge ppa:ondrej/apache2
The Ubuntu 18.04 upgrade switches Apache 2 back to the prefork MPM because Php 7.2 is not thread safe. I don’t need mod_php, as I’m using the php-fpm method. So I can remove mod_php and safely go back to the event MPM.
a2dismod php7.2 a2dismod mpm_perfork a2enmod mpm_event
There’ll be messages along the way to suggest restarting Apache 2 via
systemctl restart apache2. You can do that, but I don’t because the php-fpm setup is still broken, so my website won’t work yet anyway. This the next step here, to get php-fpm up.
$ apt install php-fpm php-mysql $ a2enconf php7.2-fpm
Then edit /etc/php/7.2/fpm/pool/www.conf and modify as needed. I had changed the user/group from www-data to my site-specific user. The new php-fpm also changes its socket location, so I needed to modify where Apache 2 expects to find it. This is usually configured in /etc/apache2/conf-enabled/php7.2-fpm.conf. I had mine configured via ProxyPass in another configuration file.
You can now restart Apache 2 with
systemctl restart apache2.
At this point, the Ubuntu 18.04.1 with Apache 2 setup should be complete and working.
The other matter I had an issue with is about brotli compression. This was included in Ondrej’s Apache 2 PPA, but not available in the stock Ubuntu 18.04 repository. Although I can download I compile any needed software myself, I often prefer to go with a package that can be provided by some repository. This is on the assumption that a well-maintained repository is more likely to keep the packages more up-to-date than I can or have the time to. I decided to break my rule this time, and even though mod_brotli can be obtained from the official Apache 2 sources, I’ll go with this build via Github from Ayesh.
Here are the steps, starting first to remove brotli if it’s already installed:
$ rm /etc/apache2/mods-enabled/brotli* $ rm /etc/apache2/mods-available/brotli*
Then get on with the build and install from Github:
$ cd /tmp $ git clone --depth=1 --recursive https://github.com/kjdev/apache-mod-brotli.git $ cd apache-mod-brotli $ ./autogen.sh $ ./configure $ make $ install -D .libs/mod_brotli.so /usr/lib/apache2/modules/mod_brotli.so -m 644 $ cd /etc/apache2/mods-available $ echo “LoadModule brotli_module /usr/lib/apache2/modules/mod_brotli.so” > brotli.load
Create brotli.conf in /etc/apache2/mods-available/brotli.conf with the following contents:
Restart Apache 2 with
systemctl restart apache2 and we’re done.
This is the setup at zitseng.com right now:
- Ubuntu 18.04.1
- Apache 2.4.29 with HTTP/2, TLS,
Update (2018-08-22): The upgrade to php 7.2 some how also dropped php-gd, so if needed, you may have to run
apt install php-gd to get it back.