Since 2016 · 50,000+ customers · ★ 5.0 on Google Live chatWhatsAppTelegramOpen a ticket
Get started
Linux

How to Upgrade Ubuntu 20.04 to 22.04, 24.04 and 26.04

How to upgrade Ubuntu 20.04 to the latest LTS by 99RDP

Ubuntu 20.04 LTS "Focal Fossa" reached the end of standard support in May 2025. It no longer gets free security updates unless you enable Ubuntu Pro's Extended Security Maintenance. The way forward is to upgrade release by release: Ubuntu only supports upgrading from one LTS to the next, so 20.04 goes to 22.04, then 24.04, then 26.04. This guide covers preparing the server, running each upgrade safely over SSH, what to check between steps, and what to do if something goes wrong.

Quick answerBack up the server, then run:

sudo apt update && sudo apt full-upgrade -y
sudo reboot
sudo do-release-upgrade

That moves 20.04 to 22.04. Reboot, check your services, and run sudo do-release-upgrade again for 24.04, then once more for 26.04. You cannot skip directly from 20.04 to 24.04 or 26.04.

Should you upgrade or reinstall?

Upgrading in place keeps your configuration, users and data and works well for most servers. For heavily customised servers or several LTS jumps at once, a fresh install of Ubuntu 24.04 or 26.04 on a new VPS, followed by migrating your sites and data, can be cleaner and avoids downtime on the old server. If you are not sure, take a snapshot and try the upgrade on a copy first.

Upgrade path for Ubuntu LTS: 20.04 to 22.04 to 24.04 to 26.04, one release at a time
One LTS at a time

Step 1: Back up and check free space

  • Take a full backup or a provider snapshot. An LTS upgrade replaces most of the system.
  • Back up databases separately: mysqldump --all-databases > all.sql or pg_dumpall > all.sql.
  • Check disk space with df -h. Have at least 5 GB free on / and some free space on /boot.
  • Note what is running: systemctl list-units --type=service --state=running.
Steps for each Ubuntu release upgrade: back up, update fully, disable PPAs, run do-release-upgrade, check
Each upgrade step

Step 2: Fully update the current release

sudo apt update
sudo apt full-upgrade -y
sudo apt autoremove --purge -y
sudo reboot

The upgrader refuses to start if packages are held back or updates are pending, so this step is required.

Step 3: Prepare third-party repositories

PPAs and third-party repositories (for example for PHP, MariaDB, Node.js or Docker) are disabled during the upgrade. List them:

ls /etc/apt/sources.list.d/

After each upgrade, re-enable only those that publish packages for the new release, and update their release name if needed. Packages from disabled repositories may be downgraded to Ubuntu's own versions or removed.

Step 4: Make sure the upgrader is set to LTS

sudo apt install update-manager-core
grep Prompt /etc/update-manager/release-upgrades

It should show Prompt=lts. If it says never, change it to lts.

Step 5: Run the release upgrade

On a remote server, start a tmux or screen session first so a dropped connection does not kill the upgrade:

sudo apt install tmux
tmux
sudo do-release-upgrade

Over SSH, the upgrader warns you and starts an extra SSH daemon on port 1022 as a fallback. Allow it in your firewall temporarily if you use one (sudo ufw allow 1022/tcp).

During the upgrade you will be asked to:

  • Confirm the list of packages to install, upgrade and remove.
  • Decide whether to keep your modified configuration files or install the package maintainer's version. For files you changed on purpose (for example sshd_config or nginx.conf), keep yours (the default). You can compare them later with the .dpkg-dist copies.
  • Restart services automatically. Usually answer yes.
  • Remove obsolete packages at the end.

When it finishes, reboot.

Step 6: Check, then repeat for the next LTS

lsb_release -a
systemctl --failed
sudo apt update && sudo apt full-upgrade -y

Test your websites, databases and applications before moving on. Then run sudo do-release-upgrade again: 22.04 to 24.04, and 24.04 to 26.04. Upgrades between LTS releases are offered once the new release's first point release (for example 26.04.1) is out.

What changes along the way

  • PHP: each release ships a newer PHP (20.04 had 7.4; later releases move to 8.x). Check that your applications support the new version, and install the matching PHP modules.
  • Python: 20.04 shipped Python 3.8, which newer releases replace. Recreate virtual environments after the upgrade.
  • Databases: MySQL and PostgreSQL major versions change. PostgreSQL clusters need pg_upgradecluster to move data to the new version.
  • Networking and SSH: from 22.10 onwards, SSH uses socket activation. On 24.04 and later, after changing the SSH port in sshd_config, run systemctl daemon-reload and restart ssh.socket.
  • Desktop: Ubuntu 26.04's GNOME desktop is Wayland-only, so remote desktops using xrdp need XFCE or MATE.

If you cannot upgrade yet

Enable Ubuntu Pro to keep receiving security patches for 20.04 through Extended Security Maintenance. It is free for personal use on a small number of machines:

sudo pro attach <your-token>
sudo pro status

Troubleshooting

  • "Please install all available updates for your release before upgrading": run sudo apt full-upgrade and reboot, then try again.
  • "No new release found": check Prompt=lts, and remember the next LTS is offered after its first point release. sudo do-release-upgrade -d forces it earlier, which is not recommended for production.
  • Upgrade interrupted: reconnect to the tmux session with tmux attach, or run sudo dpkg --configure -a and sudo apt -f install.
Troubleshooting Ubuntu release upgrades: no new release found, held packages, broken packages and SSH upgrades
Common upgrade problems

Frequently asked questions

Can I upgrade directly from Ubuntu 20.04 to 24.04?

No. Upgrade to 22.04 first, then to 24.04, and then to 26.04 if you want the latest LTS.

Is Ubuntu 20.04 still supported?

Standard support ended in May 2025. Security updates continue only through Ubuntu Pro's Extended Security Maintenance.

How long does an Ubuntu release upgrade take?

Usually 20 to 60 minutes per step on a VPS, depending on the number of packages and disk speed.

Will upgrading delete my files?

No, your data and home directories stay. Some packages from third-party repositories may be removed, so back up before you start.

Nishant Kumar, Sr. Server Engineer at 99RDP
Written byNishant KumarSr. Server Engineer, 99RDP. Part of the team that runs our servers and answers support.
Keep reading

More Linux guides

All Linux guides

Need a server for this?

✓ Setup in minutes✓ Full admin access✓ 7-day refund on new services