Upgrading your Debian server ensures you benefit from the latest features, security updates, and performance improvements. The latest stable Debian distribution (at the time of writing this tutorial) is Debian 12 (bookworm) 12.8.0.
This guide explains how to manually upgrade your Debian server from version 10 (Buster) to version 12 (Bookworm) safely and efficiently.
Important: Upgrading from Debian 10 (Buster) to Debian 12 (Bookworm) should typically be done in stages. Skipping an intermediate release (Debian 11, Bullseye) could introduce unexpected issues due to changes in dependencies and configurations. The recommended upgrade path is sequential: first from Debian 10 to 11, and then from 11 to 12.
Prerequisites
Before proceeding to the upgrade task, ensure the following:
- A full backup of your server and critical data.
- Root or sudo access to the server.
Easy Steps to Upgrade from Debian 10 to Debian 12
In the following commands we assume you have root access on the server. In your case, if you will be using a sudo-privileged account, prepend the “sudo” to each command.
Stage 1: Upgrade from Debian 10 to Debian 11
Step 1.1: Update Existing Packages
root@my-server:~# apt update -y && apt upgrade -y
root@my-server:~# apt full-upgrade -y
Now, remove any unused dependencies with the following two commands:
root@my-server:~# autoremove --purge -yroot@my-server:~# apt autoclean
Step 1.2: Update Sources List for Debian 11:
Edit /etc/apt/sources.list
to replace all occurrences of buster
with bullseye
:
root@my-server:~# deb http://deb.debian.org/debian bullseye main contrib non-free
root@my-server:~# deb http://security.debian.org/debian-security bullseye-security main contrib non-free
root@my-server:~# deb http://deb.debian.org/debian bullseye-updates main contrib non-free
Save the file and exit.
Step 1.3: Perform Upgrade to Debian 11
Now that our sources list is updated, we are ready to proceed with the upgrade from Debian 10 to Debian 11.
Execute the following commands on your terminal:
root@my-server:~# apt update -y && apt upgrade -y
root@my-server:~# apt full-upgrade -y
root@my-server:~# apt autoremove --purge -y
If no errors appeared, proceed with a server restart using the following command:
root@my-server:~# reboot
Once the server is back online, confirm the system is running on Debian 11 using this command:
root@my-server:~# lsb_release -a
Sample output:
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye
Stage 2: Upgrade from Debian 11 to Debian 12
Step 2.1: Update Existing Packages
root@my-server:~# apt update -y && apt upgrade -y
root@my-server:~# apt full-upgrade -y
Now, remove any unused dependencies with the following two commands:
root@my-server:~# autoremove –purge -yroot@my-server:~# apt autoclean
Step 2.2: Update Sources List for Debian 11
Edit /etc/apt/sources.list
to replace all occurrences of bullseye
with bookworm
:
deb http://deb.debian.org/debian bookworm main contrib non-free
deb http://security.debian.org/debian-security bookworm-security main contrib non-free
deb http://deb.debian.org/debian bookworm-updates main contrib non-free
Save the file an exit.
Step 1.3: Perform Upgrade to Debian 12
Now that our sources list is updated, we are ready to proceed with the upgrade from Debian 11 to Debian 12.
Execute the following commands on your terminal:
root@my-server:~# apt update -y && apt upgrade -y
root@my-server:~# apt full-upgrade -y
root@my-server:~# apt autoremove --purge -y
If no errors appeared, proceed with a server restart using the following command:
root@my-server:~# reboot
Once the server is back online, confirm the system is running on Debian 12 using this command:
root@my-server:~# lsb_release -a
You can verify you are on Debian 12 if you see the following output:
No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 12 (bookworm) Release: 12 Codename: bookworm
Congratulations! You have successfully completed a gradual upgrade from Debian 10 to Debian 12!
Upgrading your server is an essential task for maintaining a secure and efficient environment. If you prefer expert assistance, NetShop ISP offers fully managed services for all server needs. Contact one of our server specialists today.