How to upgrade from Debian 10 Buster to Debian 11 Bullseye
In this guide, we've got a server that's running Debian 10 that needs to be upgraded to Debian 12.
Direct upgrades from Buster to Bookworm are not supported so we first have to upgrade from Debian 10 to 11, and then to 12.
Phew, lets get started!
Reference:
Debian 12 release notes
https://www.debian.org/releases/bookworm/amd64/release-notes/ch-about.en.html
Please note that we only support and document upgrading from the previous release of Debian (in this case, the upgrade from bullseye). If you need to upgrade from older releases, we suggest you read previous editions of the release notes and upgrade to bullseye first.
1. Getting ready for the upgrade
Backup
Before we get started, we'll take a full backup of the server
Check disk space
And we'll check there is enough free disk space to do the upgrade
df -h
Check Debian OS version
# check os verison
cat /etc/*-release
cat /etc/debian_version
Check third party repositories
Any third party repositories will also need to be updated for Debian 11 sources and the applications upgraded
ls /etc/apt/sources.list.d/
mariadb nginx and php are installed so they will have to be updated to Bullseye as part of the main OS upgrade
We're not going to cover the steps for these individually as this will be different depending on what applications you've installed

Install updates and reboot
Refresh apt sources, install updates and restart
# install updates
apt update
apt upgrade
# restart
systemctl reboot
2 Edit apt sources
Edit apt sources and change to Debian 11 Bullseye
nano /etc/apt/sources.list
apt sources.list before changes
# main
deb http://deb.debian.org/debian/ buster main contrib non-free
deb-src http://deb.debian.org/debian/ buster main contrib non-free
# security
deb http://security.debian.org/debian-security buster/updates main contrib non-free
deb-src http://security.debian.org/debian-security buster/updates main contrib non-free
# buster-updates, previously known as 'volatile'
deb http://deb.debian.org/debian/ buster-updates main contrib
deb-src http://deb.debian.org/debian/ buster-updates main contrib
# buster-backports
deb http://deb.debian.org/debian buster-backports main
Debian 11 is end of life so updates have been moved to archive.debian.org
main
replace buster with bullseye
# main
deb http://archive.debian.org/debian bullseye main contrib non-free
deb-src http://archive.debian.org/debian bullseye main contrib non-free
security
replace buster/updates with bullseye-security
# security
deb http://archive.debian.org/debian-security bullseye-security main contrib non-free
deb-src http://archive.debian.org/debian-security bullseye-security main contrib non-free
updates
replace buster-updates with bullseye-updates
# bullseye-updates, previously known as 'volatile'
deb http://archive.debian.org/debian bullseye-updates main contrib
deb-src http://archive.debian.org/debian bullseye-updates main contrib
backports
replace buster-backports with bullseye-backports
# bullseye-backports
deb http://archive.debian.org/debian bullseye-backports main
New apt sources.list for Bullseye
# main
deb http://archive.debian.org/debian bullseye main contrib non-free
deb-src http://archive.debian.org/debian bullseye main contrib non-free
# security
deb http://archive.debian.org/debian-security bullseye-security main contrib non-free
deb-src http://archive.debian.org/debian-security bullseye-security main contrib non-free
# bullseye-updates, previously known as 'volatile'
deb http://archive.debian.org/debian bullseye-updates main contrib
deb-src http://archive.debian.org/debian bullseye-updates main contrib
# bullseye-backports
deb http://archive.debian.org/debian bullseye-backports main

3 Update third party repos
Edit apt sources for third party repositories for MariaDB, Nginx and PHP
ls /etc/apt/sources.list.d/
mariadb.sources nginx.list php.list
We're not covering these step by step in this guide because each application will be different
4 Run minimal upgrade
Run minimal upgrade first before running the full OS upgrade
# refresh apt packages
apt update
# run minimal upgrade
apt upgrade --without-new-pkgs

You will get prompted for any package changes that need you to confirm or changes to config files
Installation finished. No error reported.

Restart
systemctl reboot
5 Run full upgrade
Run the full OS upgrade
apt full-upgrade

Restart
# reboot
systemctl reboot
Check OS version
cat /etc/debian_version
cat /etc/*-release
Debian has been upgraded to 11 Bullseye
