Upgrade the OS
Updated on 28 Mar 2022
Step 1 update packages
First we want to update the packages, as well as use the dist-upgrade command with apt-get. I am familiar with update
, upgrade
, remove
, clean
and their auto
variants. However dist-upgrade
is another command that is used for distribution upgrades.
sudo apt-get update
sudo apt-get dist-upgrade
Note:, Usually with dist-upgrade
command there will be a lot more happening, however I’d already run this command prior to taking this screen shot.
Step 2 dbkg configure
The next step is not strictly necessary, it is a preventative step used to configure packages that have been unpacked but not yet configured. dpkg is a low level Debian package manager that is used for installing, build and remove debian packages (.deb files).
When you encounter issues with Debian packages, quite often this step (or –reconfigure) will fix the issue.
sudo dpkg --configure -a
Step 3 Install update-manager-core
Your server will most likely have this installed, but best to check anyway.
sudo apt-get install update-manager-core
update-manager-core is used to help determine the upgrade path. We can see in the following file /etc/update-manager/release-upgrades
, that the next upgrade is following the Long Term Support (mentioned in the file as LTS
).
Step 4 Upgrade
Now that the preliminaries are out of the way, we can proceed to do the upgrade.
sudo do-release-upgrade
This process actually takes quite a while, and it is interactive so you will need to check on the progress every now and then. Your first prompt is to confirm the upgrade.
The next prompt will be confirming about restarting the machine because certain packages may require it.
The upgrade process will continue to prompt you for certain actions, and your prompts will vary depending on the packages installed and whether configuration changes have been made.
lsb_release
You can use the lsb_release command to get information about the OS. I ran this command after the upgrade, and as we can see we managed to upgrade from 18.04 -> 20.04
.
lsb_release -a
PHP
If you have PHP installed you will find that certain modules that you installed / enabled may no longer be present. You may need to reinstall these if they are missing. If this is too much hassle, you can look at update alternatives to use the previous version of PHP that will have all your modules available.