I have been on Ubuntu 20.04 LTS version for past 4 years. Recently Ubuntu 20.04 reached end of the life so it is a time for me to upgrade Ubuntu server to 24.04 LTS version.
This tutorial is an extension to my previous Ubuntu 18.04 to 20.04 upgrade experience.
Warning: Before you read further, I want to say that I don’t have any experience with Linux administration and do not know anything about various application settings. This article is for my own documentation for future use.
There is no direct upgrade path from Ubuntu 20.04 to 24.04. You must upgrade from 20.04 to 22.04. Once successful, you may upgrade from 22.04 to 24.04. So if you are interested in Ubuntu 20.04 to 22.04 upgrade, or from Ubuntu 22.04 to 24.04 upgrade, you may use this tutorial as well.
Ubuntu Upgrade Preparation
Upgrade all your packages to latest version. If you don’t upgrade, Ubuntu will not let you upgrade. Once all packages are upto date execute following command to make sure package update-manager-core is installed.
sudo apt install update-manager-core
If you don’t want a heart attack, please backup your Digital Ocean droplet. Turn off your droplet and take a snapshot in case something goes wrong.
I had encountered couple of issues during the upgrade so having a backup was much easier to restart the upgrade.
Ubuntu 20.04 to 22.04 Upgrade
I am using Virtualmin/Webmin that installs ProFTPD module. I had encountered an issue when upgrading Ubuntu 20.04 to 22.04. After multiple trial and error, I found that removing this module is a best way to handle upgrade.
I executed following commands to remove ProFTPD.
sudo apt remove proftpd*
sudo apt purge proftpd*
I wanted to upgrade to only LTS version so I used following command to upgrade
sudo do-release-upgrade
As soon as you execute above command, it will prompt you if I want to restart the services. I selected “Yes”. For “MySql” service, it said that it couldn’t restart but I did not face any issue later on.
It will also ask for opening port 1022 for SSH. I continued with that and did not face any issue.
Right before the final upgrade process, it asked for confirmation to press “Enter” key. Do NOT press “Enter” key. Instead, you need to edit “/etc/apt/sources.list” file in a separate window/session.
This upgrade process automatically comments out all digital ocean links and appends “# disabled on upgrade to jammy”.
Go ahead and uncomment all the lines by removing the first “#” character from the line.
Also you will see multiple “focal-” lines. Replace “focal” with “jammy” for those lines.
Save the updated “/etc/apt/sources.list” file and return back to upgrade window where it is waiting for you to press “Enter” key.
Now you may go ahead and press “Enter” key.
For multiple services, it asked me if I want to replace modified configuration with the latest configuration. For each service, I selected “N” that represents to keep the existing configuration file as-is.
Once the upgrade completed, it asked me to restart the server which I did.
Complete common tasks after the upgrade. Even if you still need to upgrade from Ubuntu 22.04 to 24.04, you must complete these tasks after each upgrade.
Ubuntu 22.04 to 24.04 Upgrade
I wanted to upgrade to only LTS version so I used following command to upgrade
sudo do-release-upgrade
As soon as you execute above command, it will prompt you if I want to restart the services. I selected “Yes”.
It will also ask for opening port 1022 for SSH. I continued with that and did not face any issue.
Right before the final upgrade process, it asked for confirmation to press “Enter” key. Do NOT press “Enter” key. Instead, you need to edit “/etc/apt/sources.list” file in a separate window/session.
This upgrade process automatically comments out all digital ocean links and appends “# disabled on upgrade to noble”.
Go ahead and uncomment all the lines by removing the first “#” character from the line.
Also you will see multiple “jammy-” lines. Replace “jammy” with “noble” for those lines.
Save the updated “/etc/apt/sources.list” file and return back to upgrade window where it is waiting for you to press “Enter” key.
Now you may go ahead and press “Enter” key.
For multiple services, it asked me if I want to replace modified configuration with the latest configuration. For each service, I selected “N” that represents to keep the existing configuration file as-is.
Once the upgrade completed, it asked me to restart the server which I did.
Ubuntu Upgrade Common Tasks
After the Ubuntu upgrade, you must restart the server.
Once restarted, I autoremoved all older packages by executing following commands.
sudo apt clean
sudo apt autoremove
Now I logged into Virtualmin. I performed following steps for each and every virtual server.
- Go to “Web Configuration” > “PHP Options”. It will show you a warning about php-fpm.
- Click on “Save” button, which will automatically fix the issue.
Go to “Virtualmin” > “System Settings” > “Recheck Configuration” and verify that everything is fine. If it shows warning about Virtualmin repo, execute following command
sudo virtualmin setup-repos
Ubuntu 24.04 Upgrade Issues
Ubuntu 24.04 comes with PHP 8.3 which does not install Apache 2 module mod-php8.3. Older version of Apache 2 module php8.1 was enabled which prevented Apache 2 to restart.
I had to go “Webmin” > “Servers” > “Apache Webserver” > “Global Configuration” tab > “Configure Apache Modules” tile.
I unchecked “php8.1” and “mpm_prefork” and clicked on “Enable Selected Modules” button.
Once again, I went to “Configure Apache Modules” and checked “mpm_event” for HTTP2 support and clicked on “Enable Selected Modules” button.
Now you will be able to restart Apache2.
Leave a Reply