Debian 12, codenamed "Bookworm" was released on June 10, 2023. It is a stable version and will be supported for the next 5 years. This version updates many well-known software packages, including Linux Kernel 6.1 LTS, Apache 2.4.57, MariaDB 10.11, etc.
Before upgrading to Debian 12, you should do the following:
- Back up all files to an external drive.
- Make sure you have a stable internet connection.
This article will show you how to upgrade from Debian 11 (Bullseye) to Debian 12 (Bookworm) in a few simple steps.
Update system
Log in to the server as the root user. If you are not root yet, run the following command:
su -
Verify your operating system version using the following command:
lsb_release -a
You should see the following output:
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye
Run the following commands to update and upgrade all packages:
apt-get update
apt-get upgrade
apt-get dist-upgrade
Next, remove all unnecessary packages using the following command:
apt-get autoremove
Afterwards, you should restart your system to apply all updates:
reboot
Update repository files
We will now update the repository source to use the Debian 12 Bookworm repository.
To do this, you can update all source files by running the following command:
sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list
sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list.d/*.list
Or manually edit the APT source file using the following command:
nano /etc/apt/sources.list
Replace "bullseye" with "bookworm".
The result should be similar to the following:
deb http://deb.debian.org/debian bookworm main contrib non-free
deb http://deb.debian.org/debian bookworm-updates main contrib non-free
deb http://security.debian.org/debian-security bookworm-security main
Save and close the file when finished.
If there are more APT source files in /etc/apt/sources.list.d/, edit them and replace "bullseye" with "bookworm".
Starting with Debian 12 "Bookworm", all non-free firmware packages (i.e. firmware-amd-graphics, firmware-iwlwifi, firmware-misc-nonfree) have been moved to their own archived components ("non-free-firmware"), If you have a non-free firmware package installed on your system, you will need to add it to the sources.list file.
example:
deb https://deb.debian.org/debian bookworm main
will become:
deb https://deb.debian.org/debian bookworm main non-free-firmware
Upgrading operating system from Debian 11 (bullseye) to Debian 12 (bookworm)
At this point, your server is ready for upgrade.
First, update the repository to apply the changes you made in the previous step.
apt-get update -y
During the update process, the system may ask for your input, such as when it wants to restart a service, update a configuration file, or read the release notes. Check these queries one by one, and for configuration files it is usually best to compare the differences between the current version of the configuration file and the proposed new version.
Update existing packages without installing new ones:
apt-get upgrade --without-new-pkgs -y
Once this is done, run the following command to start the upgrade:
apt-get full-upgrade -y
After the system is upgraded, reboot to apply all updates.
reboot
Verify upgrade
You can now verify the upgrade using the following command:
lsb_release -a
You should see the Debian 12 version in the following output:
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 12 (bookworm)
Release: 12
Codename: bookworm
in conclusion
Your server is now upgraded to the latest Debian LTS version.