Upgrading to a new version of the operating system significantly improves the security of your system. Debian 12 will contain the latest vulnerability fixes, which will provide more reliable protection against hacking or other cyber attacks. Also, upgrading Debian 11 to Debian 12 may help fix some known issues or bugs that you encountered in the previous version. This may include bug fixes in programs or improving compatibility with other applications and hardware.
Before updating packages, it is necessary to adjust the repository configuration file.
You can adjust the repository file with one command:
sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list
Just copy and paste the command into the command prompt, having previously connected via SSH and press Enter
Next, you need to update the package index with the following command:
root@vm1320372:/tmp# apt update
Get:1 http://security.debian.org/debian-security bookworm-security InRelease [48.0 kB]
Get:2 http://deb.debian.org/debian bookworm InRelease [151 kB]
Get:3 http://deb.debian.org/debian bookworm-updates InRelease [52.1 kB]
Get:4 http://security.debian.org/debian-security bookworm-security/main amd64 Packages [48.0 kB]
Get:5 http://security.debian.org/debian-security bookworm-security/main Translation-en [26.4 kB]
Get:6 http://deb.debian.org/debian bookworm/main amd64 Packages [8906 kB]
Get:7 http://deb.debian.org/debian bookworm/main Translation-en [6078 kB]
Get:8 http://deb.debian.org/debian bookworm/non-free amd64 Packages [98.6 kB]
Get:9 http://deb.debian.org/debian bookworm/non-free Translation-en [67.2 kB]
Get:10 http://deb.debian.org/debian bookworm/contrib amd64 Packages [54.3 kB]
Get:11 http://deb.debian.org/debian bookworm/contrib Translation-en [48.7 kB]
Get:12 http://deb.debian.org/debian bookworm-updates/main amd64 Packages [4732 B]
Get:13 http://deb.debian.org/debian bookworm-updates/main Translation-en [3528 B]
Fetched 15.6 MB in 3s (4846 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
204 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@vm1320372:/tmp#
Now you need to make a minimal update of the operating system with the command:
sudo apt upgrade --without-new-pkgs
During the update process, you will need to confirm the operation by pressing the “Y" symbol. When requesting an update system to automatically restart services, you must answer in the affirmative.
Next, you need to update the system packages.
Please note that in order to preserve data, we highly recommend deleting all packages installed from third-party repositories and also deleting third-party repositories. After the update, you will be able to add the necessary repositories again.
To update packages, run the command:
apt full-upgrade
During the upgrade process, the system overwrites the configuration files. If the update process sees files that differ from those used by default in Debian, it will ask what to do with each file individually. You can leave your own copy of the file (not overwrite it), overwrite the file, or get acquainted with the differences in the files.
The last step is to restart your server. After downloading, you can check the current version with the following command:
root@vm1320372:~# cat /etc/*release PRETTY_NAME="Debian GNU/Linux 12 (bookworm)" NAME="Debian GNU/Linux" VERSION_ID="12" VERSION="12 (bookworm)" VERSION_CODENAME=bookworm ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/" root@vm1320372:~#
After the update, you need to check that all the services on the server have started.