Author: Humphrey MpairweLast Updated: Fri, Jan 7, 2022
Debian 11 (Bullseye) is the new stable version of the Debian Linux operating system, which offers a wide range of updated software packages. Best of all, it comes with five years of support. This article explains how to upgrade an existing Debian 10 server to Debian 11.
Update the available packages.
$ sudo apt update
Upgrade all the existing packages.
$ sudo apt upgrade
Remove any unnecessary dependency files.
$ sudo apt autoremove
Before upgrading to Debian 11, make a backup of your current server status in case things go wrong. You can do this by creating a snapshot of your server.
The snapshot process will start, and depending on your server size, it may take between five and ten minutes to complete. When finished, the status changes from pending to available.
Aptitude (Apt) downloads packages from one or more repositories for installation on your server. It finds the correct repositories, available packages, and versions to download in
/etc/apt/sources.list. So, you need to replace all Debian 10 codenames with Debian 11 codenames in
Confirm the Debian 10 codename by running the following command. Debian 10 is codenamed buster.
$ lsb_release -a
Your output should be:
No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 10 (buster) Release: 10 Codename: buster
buster entries in the sources list to
bullseye, which is the codename for Debian 11.
Back up the original configuration files to your home directory.
$ sudo cp /etc/apt/sources.list ~/sources.bak $ sudo cp -r /etc/apt/sources.list.d/ ~/sources.list.d.bak
/etc/apt/sources.list in your favorite editor.
$ sudo nano /etc/apt/sources.list
The current entries should look like this:
deb http://deb.debian.org/debian/ buster main deb-src http://deb.debian.org/debian/ buster main deb http://security.debian.org/debian-security buster/updates main deb-src http://security.debian.org/debian-security buster/updates main # buster-updates, previously known as 'volatile' deb http://deb.debian.org/debian/ buster-updates main deb-src http://deb.debian.org/debian/ buster-updates main
Replace those lines with:
deb http://deb.debian.org/debian bullseye main deb-src http://deb.debian.org/debian bullseye main deb http://security.debian.org/ bullseye-security main deb-src http://security.debian.org/ bullseye-security main deb http://deb.debian.org/debian bullseye-updates main deb-src http://deb.debian.org/debian bullseye-updates main
Save and close the file.
Update the package list a second time. If you made the changes correctly, there won't be any errors displayed during the update process.
$ sudo apt update
Perform a system upgrade. Use the
--without-new-pkgs flag to avoid removing the packages you intend to keep on your server.
$ sudo apt upgrade --without-new-pkgs
You will be prompted to restart specific services or to keep and erase specific config options. Answer yes.
apt-listchanges package is installed it will display information about the upgraded packages. Type Q to exit the pager.
Now you can safely run a full upgrade to Debian 11 with the following command:
$ sudo apt full-upgrade
This will run a full upgrade of the server from Debian 10 to Debian 11, resolve possible dependencies changes, install the newest versions of all packages, and remove any obsolete packages. During the system upgrade process, additional prompts may be displayed to restart services and update existing configuration options. Be sure to select appropriate choices to avoid unwanted changes to existing applications.
When a pager indicator
: is displayed, type Q to continue.
Type Y when prompted to modify
Configuration file '/etc/sysctl.conf' ==> Modified (by you or by a script) since installation. ==> Package distributor has shipped an updated version. What would you like to do about it ? Your options are: Y or I : install the package maintainer's version N or O : keep your currently-installed version D : show the differences between the versions Z : start a shell to examine the situation The default action is to keep your current version.
After the system upgrade is complete, restart your server for changes to take effect.
$ sudo reboot now
Your current SSH connection will be dropped.
Wait for a minute for the server to reboot.
Check the current operating system version and verify it shows Debian 11, bullseye.
$ lsb_release -a
No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 11 (bullseye) Release: 11 Codename: bullseye
Some packages may have been upgraded to newer versions during the upgrade process, but they will still use the same configuration files and ports. Verify your existing apps one by one and also check the error logs depending on your server setup. For instance, check whether Apache2 is installed and running:
$ sudo service apache2 status
To confirm if MySQL is present:
$ sudo service mysql status
To check your current PHP version:
$ php -v
Several applications may need new versions during the upgrade from Debian 10 to Debian 11. Depending on your installation type, some may have been automatically updated during the process, or you may have to update the latest versions manually. To secure the server, remove any outdated packages.
$ sudo apt --purge autoremove
Confirm if the Uncomplicated Firewall (ufw) is running and set some rules to tighten connections to your server.
$ sudo ufw status
To allow a service like HTTP, run:
$ sudo ufw allow http
Congratulations, you have successfully upgraded your server from Debian 10 "Buster" to Debian 11 "Bullseye" and retained existing applications on the server. Typically, you should expect about 15 minutes of downtime.
For more information, see these articles at debian.org.