Methods of payment Abuse

How to upgrade Debian 11 to Debian 12

26.07.2023, 19:01

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 better protection against hacking or other cyberattacks. Upgrading from Debian 11 to Debian 12 may also help fix some known issues or bugs you encountered with the previous version. This may include bug fixes for programs or improved compatibility with other applications and hardware.

Upgrade instructions

Before upgrading packages, you must adjust the repositories configuration file.

You can adjust the repositories file with a single command:

sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list

Simply copy and paste the command into the command prompt by first connecting via SSH protocol and press the Enter key

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 do 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 prompted by the update system to automatically restart services, you must answer in the affirmative.

Next, the system packages need to be updated.

Please note that for data security reasons it is highly recommended to remove all packages installed from third-party repositories and remove third-party repositories as well. After the upgrade you will be able to add the required repositories again.

To upgrade packages you need to run the command:

apt full-upgrade

During the upgrade process, the system overwrites the configuration files. If the upgrade process sees files that are different from Debian's defaults, it will ask what to do with each file individually. You can keep your own copy of the file (not overwrite it), overwrite the file, or read the differences in the files.

The last step is to restart your server. After the download 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 upgrade, you should check that all services on the server are running.