Are you planning to upgrade from Debian 11 (Bullseye) to the newest version of Debian 12 (Bookworm)? Finally, the most recent Debian 12 release is available, which provides end users with lots of additional potential options. Stability and variety are two concepts that come to mind while discussing Debian.
We will show you in this guide, how to upgrade the Debian distribution from Debian 11 (Bullseye) to Debian 12 (Bookworm) distribution using the command line.
Steps to Upgrade from Debian 11 to Debian 12
If you want to upgrade your existing Debian 11 distribution to the latest version Debian 12, use the following steps:
Step 1: Check the Debian Version
First, check the installed Debian distribution name and version number by using the following commands:
$ lsb_release -d
$ $ cat /etc/debian_version
Step 2: Update and Upgrade existing system packages
If you are a Linux user, you might familiar with the update and upgrade commands. Both commands are different. But you can use them together in a single command statement to update and upgrade your system repositories easily:
$ sudo apt update
$ sudo apt upgrade
$ sudo apt update && sudo apt upgrade
Once the updates are complete, remove the unnecessary packages from the Debian 11 distribution using this command:
$ sudo apt --purge autoremove
Step 3: Edit the sources.list File from Debian 11 Bullseye to Debian 12 Bookworm
Once you upgrade all packages of your system, edit the ‘source.list’ file. This file contains the detail of all package sources. Open the ‘source.list’ file in a source code editor. Here, we are using nano editor to edit the source file.
$ sudo nano /etc/apt/sources.list
Find and replace all “bullseye” instances in the file with “bookworm” instances.
Save all changes using ‘Ctrl+O’ and exit from this file using ‘Ctrl+X’.
Step 4: Update all System Packages
At this stage, you have replaced sources pointing to Debian 11 repositories. Now, you have Debian’s 12 repositories in the “source.list” file. It’s time to update all system repositories and packages. You can update repositories using this command:
$ sudo apt update
Step 5: Upgrade existing Packages
After updating the system packages, you need to upgrade your existing packages without installing any new packages on your system. To upgrade existing packages, use this command:
$ sudo apt -y upgrade --without-new-pkgs
Confirm the user prompt:
Step 6: Run Full System Upgrade
In this step, you will perform the final upgrade to Debian 12 “Bookworm.” Execute the following command to upgrade your system from Debian 11 to the newest version Debian 12:
$ sudo apt full-upgrade -y
It is a time-consuming process to upgrade your entire system. Therefore, after running the above command, you will sit back and wait until all system is upgraded.
Step 7: Reboot System
Once the upgrade process is complete, use the following command to reboot your Debian system:
$ sudo reboot
Login to your system:
After rebooting the system, check the Debian distribution or release name and version using these commands:
$ lsb_release -a
Finally, you can also remove the unnecessary packages using this command:
$ sudo apt --purge autoremove -y
In this guide, we demonstrated how to upgrade to Debian 12 from Debian 11 bullseye distribution using the command line. Although this is a time-consuming task, most users prefer to upgrade their existing distribution instead of installing a new version on your Linux system. So, enjoy the benefits of the Debian 12 Bookworm on your machine. If you want to get more details about Debian releases visit the official Debian releases page.