Keeping a server up to date with the latest security patches and updates available for the operating system is always a good practice. This helps in protecting the server against any vulnerabilities that were present in the older versions of the operating system.
Debian 11 (Bullseye) is the latest Long Term Support release with the security patches. Hence, upgrading the Debian system with an older to the latest version is always a good option.
This guide outlines the basic steps for upgrading Debian 10 to Debian 11.
IMPORTANT NOTE: Always make sure that the server data is backed up first before proceeding with such upgrade processes as there are high risks of data loss during such operations.
Preparing for the upgrade process
Execute the below command to first check the version of Debian installed in the server.
# lsb_release -a
The initial step to being performed before proceeding with the OS upgrade is to update and upgrade the server packages.
Run the below command to update and upgrade the packages:
# sudo apt update && sudo apt upgrade -y
Reboot the server once.
# reboot
Once the server is rebooted, run the below command to remove any unused packages and kernels.
# sudo apt autoremove
Change the Debian Sources
Replace all Debian 10 code names with Debian 11 code names in /etc/apt/sources.list
file.
Before that, run the below commands to back up the original configuration files to your home directory.
# cp /etc/apt/sources.list ~/sources.backup
# cp -r /etc/apt/sources.list.d/ ~/sources.list.d.backup
Using any editor of choice, open the /etc/apt/sources.list
.
# vi /etc/apt/sources.list
The current entries should be the same as in the below screenshot:
Replace those with the below entries, then save and close the file.
deb http://deb.debian.org/debian bullseye main
deb http://deb.debian.org/debian bullseye main
deb http://deb.debian.org/debian bullseye main
deb-src http://security.debian.org/ bullseye/updates main
deb-src http://security.debian.org/ bullseye/updates main
deb-src http://deb.debian.org/debian bullseye-updates main
deb http://deb.debian.org/debian bullseye-backports main
deb-src http://deb.debian.org/debian bullseye-backports main
Update the package list again with the below command.
# apt update
Run the below command to perform a system upgrade.
# apt upgrade --without-new-pkgs
After installing the apt-listchanges package
, it displays information about the upgraded packages. Type q
to exit the pager.
Also, it will prompt the below screenshot to restart specific services or to keep and erase specific config options. Answer Yes
and then press Enter
.
Upgrade Debian 10 to 11
Execute the below command for a full upgrade to Debian 11.
# apt full-upgrade
Configuring openssh-server
Select the option to keep the local version currently installed:
Reboot the server now.
# reboot
Once the server has been rebooted, log in as root and verify the completion of the upgrade process by checking the current Debian version on the server.
# lsb_release -a
Related Tutorial