You can upgrade an Ubuntu VPS in place, one LTS release at a time: from 20.04 to 22.04, then from 22.04 to 24.04. Your VPS is self-managed, so you run the upgrade yourself from inside the server. If you would rather start fresh, changing the operating system in mPanel replaces the installation and deletes the data on the disk; it is not an in-place upgrade (see What operating systems are available?).
Warning: Confirm that you have a tested, recoverable backup before upgrading. An in-place operating system upgrade can cause downtime or application compatibility problems. Changing the operating system from mPanel is a reinstall and deletes the data on the VPS disk.
TABLE OF CONTENTS
- Check your applications and PHP version
- Before each upgrade
- Run the upgrade
- Third-party repositories and PPAs
- If you cannot upgrade straight away
Check your applications and PHP version
The main risk in an upgrade is application compatibility. Each release changes the default PHP version:
- Ubuntu 20.04: PHP 7.4
- Ubuntu 22.04: PHP 8.1
- Ubuntu 24.04: PHP 8.3
Before you start, confirm that your application, its plugins and the PHP extensions it uses support the PHP version of each release you are moving to.
Before each upgrade
- Confirm your backups include everything you would need to recover the service: application data, databases and configuration.
- Check that the server has enough free disk space for the upgrade with
df -h. The total size of the disk does not tell you this. - Keep the Rescue Console on the VPS's Overview page in mPanel available in case your SSH session drops during the upgrade.
Run the upgrade
Repeat these steps for each release jump: first 20.04 to 22.04, then 22.04 to 24.04.
- Fully update the current release:
sudo apt update sudo apt dist-upgrade -o APT::Get::Always-Include-Phased-Updates=true
- Check whether a reboot is needed:
ls /run/reboot-required
If the file exists, reboot withsudo rebootand reconnect before you continue. - Start the release upgrade and follow its prompts:
sudo do-release-upgrade
- When the upgrade finishes and the server has restarted, check your application before moving on to the next release.
Third-party repositories and PPAs
The upgrade disables third-party repositories and PPAs automatically. Afterwards, review them and re-enable only the ones that support the new Ubuntu release, rather than commenting them out and adding them back by hand.
If you cannot upgrade straight away
Ubuntu 20.04 is outside Canonical's standard support period. If you need security fixes before you can complete the upgrade, Ubuntu Pro (Expanded Security Maintenance) continues to provide security updates for 20.04 packages, including PHP 7.4. Treat it as a stop-gap and plan the upgrade.
If you require assistance, feel free to submit a support ticket at our helpdesk here: Submit a ticket | BinaryLane
