There is no need to reinstall Ubuntu or Debian servers if you wish to switch to a new major version (release): both distributions support in-place upgrades. This is necessary if support for the version you are using is coming to an end, or if you require newer software versions (PHP, database, libraries).
For AlmaLinux and Rocky Linux, see: Updating AlmaLinux and Rocky Linux to a new major version using ELevate.
We tested these steps in October 2026 with an Ubuntu 24.04 → 26.04 and a Debian 12 → 13 update, on virtual machines installed from the distributions’ own cloud images.
Before you begin
- Create a full backup or snapshot of the server.
- Ensure you have access independent of SSH, such as a VNC console, in case the server is unavailable on the network after a reboot.
- Please upgrade one version at a time. You cannot skip versions: for example, to upgrade from Debian 11 to 13, you must go via version 12.
- Check the external repositories (
/etc/apt/sources.list.d/), such as PPAs, the Docker, MariaDB or Sury PHP repositories. Disable these whilst the update is in progress, then reconfigure them for the new release. -
Update the current version to the latest release and restart:
sudo apt update sudo apt full-upgrade sudo reboot
During the update, the system will ask you several questions (for example, whether to overwrite a modified configuration file). If you have previously modified the file, it is generally safer to keep the existing version (select N or “keep the local version currently installed”). After the update, you will find the new default file with the extension .dpkg-dist or .ucf-dist, and you can compare it with your own.
Ubuntu: do-release-upgrade
On Ubuntu, the update is carried out by the do-release-upgrade command. LTS (Long-Term Support) releases are recommended for servers, and by default, the command only offers an upgrade to the next LTS release. Updates to the new LTS release usually only become available after the first maintenance release (e.g. xx.04.1) has been released. The command do-release-upgrade -c shows whether a new release is available; in the test on Ubuntu 24.04, it displayed: New release '26.04.1 LTS' available.
sudo apt install update-manager-core
sudo do-release-upgrade
- When run via SSH, the program issues a warning and starts a backup SSH server on port 1022, in case the main SSH connection is lost. If a firewall is running on the server, temporarily open this port (
sudo ufw allow 1022/tcp) and close it after the update (sudo ufw delete allow 1022/tcp). - At the end of the update, the program offers to remove obsolete packages and restart the system.
If the program indicates that no new release is available, check the file /etc/update-manager/release-upgrades to ensure that the value of Prompt is set to lts.
During the test, the update ran without any errors; after restarting, the system was running Ubuntu 26.04.1 LTS with a 7.0 kernel. There are two changes to note in Ubuntu 26.04: the sudo command is now the Rust-written sudo-rs (the first line of sudo -V is: sudo-rs 0.2.13…), and OpenSSH has been updated to major version 10. The usual sudo commands and settings work as expected, but if you have any custom sudoers configurations, please check that they are still functioning correctly.
Debian
On Debian, updates are carried out by updating the package repositories and using the apt commands. The example below shows how to update Debian 12 (‘bookworm’) to Debian 13 (‘trixie’).
Run longer commands in atmux or screensession (see: Running commands over an intermittent SSH connection).
1. Rewriting storage
Replace the name of the old release with the new one in the list of repositories. The repositories may be located in one of two places: in the old /etc/apt/sources.list file, or in the newer-format /etc/apt/sources.list.d/debian.sources file. On the Debian 12 cloud image used in the test, they were in the latter; the sources.list file contained only a comment, so please carry out the replacement in both files:
sudo sed -i 's/bookworm/trixie/g' /etc/apt/sources.list
sudo sed -i 's/bookworm/trixie/g' /etc/apt/sources.list.d/debian.sources
In the debian.sources file, following the change, the Suites: lines should read trixie trixie-updates trixie-backports and trixie-security. Please check the files: the security repository line should be changed to trixie-security, and the updates line to trixie-updates.
grep -r "bookworm" /etc/apt/sources.list /etc/apt/sources.list.d/
If the command does not display anything, all storage devices have been switched over.
2. The update in two steps
sudo apt update
sudo apt upgrade --without-new-pkgs
sudo apt full-upgrade
The first, ‘minimal’ update updates existing packages without installing any new ones; the second performs a full update, installing the necessary new packages and removing the obsolete ones. On a server containing only a few packages, this takes a few minutes; in the test, the two steps were completed in under two minutes.
3. Restarting and cleaning up
sudo reboot
After restarting:
cat /etc/debian_version
sudo apt autoremove
In the test, the output of cat /etc/debian_version was 13.7; apt autoremove removed 25 obsolete packages; there were no faulty services.
After the update
- Check that all services have started:
systemctl --failed. - Check the web server and database logs (see: Reading log files on Linux).
- The new release introduces a new version of PHP: please check that the web server is using the new PHP-FPM service and that your website works with it.
- Before the update, switch back to and reconfigure any external storage devices that were disabled prior to the update.