Ubuntu 16.04 went EOL on April 2021. In this post, I will demonstrate how to do an in-place upgrade to the latest release.
For this exercise, I first installed Ubuntu 16.04 server using the official iso file. I selected the LAMP package group as I am interested to see how Ubuntu handles the upgrade of mysql. These are what I have after installation:
[email protected]:~# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04.7 LTS Release: 16.04 Codename: xenial
[email protected]:~# mysql --version mysql Ver 14.14 Distrib 5.7.31, for Linux (x86_64) using EditLine wrapper [email protected]:~# apachectl -v Server version: Apache/2.4.18 (Ubuntu) Server built: 2020-06-15T14:09:55 [email protected]:~# php -v PHP 7.0.33-0ubuntu0.16.04.15 (cli) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.0.33-0ubuntu0.16.04.15, Copyright (c) 1999-2017, by Zend Technologies
Upgrade to 18.04
The upgrade process is no different than any other upgrade. First, run the following to update all packages.
apt -y upgrade reboot
Next, run the following command to begin upgrading the OS to 18.04 bionic. This will run for 10-15 minutes. The tool will ask a few questions, it is ok to answer yes to all of them. The system will reboot at the end.
do-release-upgrade
When the OS comes back, it has been successfully upgraded. No drama on the OS or LAMP.
[email protected]:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.6 LTS
Release: 18.04
Codename: bionic
[email protected]:~# mysql --version mysql Ver 14.14 Distrib 5.7.37, for Linux (x86_64) using EditLine wrapper
[email protected]:~# apachectl -v Server version: Apache/2.4.29 (Ubuntu) Server built: 2022-03-16T16:53:42
[email protected]:~# php -v PHP 7.2.24-0ubuntu0.18.04.11 (cli) (built: Mar 2 2022 17:52:35) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.2.24-0ubuntu0.18.04.11, Copyright (c) 1999-2018, by Zend Technologies
Upgrade from 18.04 to 20.04 focal
Run the same command again and it will upgrade to 20.04. If you do not have any package installed from PPA or any other sources, the upgrade should be successful just like the last one.
do-release-upgrade
After rebooting, I am now on 20.04. Mysql is successfully upgraded with no manual steps.
[email protected]:~# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.4 LTS Release: 20.04 Codename: focal [email protected]:~# mysql --version mysql Ver 8.0.28-0ubuntu0.20.04.3 for Linux on x86_64 ((Ubuntu)) [email protected]:~# apachectl -v Server version: Apache/2.4.41 (Ubuntu) Server built: 2022-03-16T16:52:53 [email protected]:~# php -v PHP 7.4.3 (cli) (built: Mar 2 2022 15:36:52) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies
Wrapping up
One of the things I like about Ubuntu is the ability to perform in-place upgrade. And it is fairly straight forward. Once again, as long as there is no externally installed packages, the upgrade should go without problem. If you do have those installed, you may need to uninstall them and reinstall them manually. They are likely to cause dependency problems and prevent do-release-upgrade from completing.