How to Upgrade to Debian 12
This post will show you how to upgrade Debian 11 (Bullseye) to Debian 12 (Bookworm).
Step 1: Create backup
This is very important. If something goes wrong, you can always go back from the backup/snapshot.
Step 2: Update current packages
sudo apt update
sudo apt upgrade
sudo apt full-upgrade
sudo apt autoremove
Step 3: Upgrade to the new version of Debian
cat /etc/apt/sources.list # inspect content
sudo sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list
cat /etc/apt/sources.list.d/*.list # inspect content
sudo sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list.d/*.list
sudo apt update
sudo apt upgrade
sudo apt full-upgrade
sudo apt autoremove
Tips:
During the upgrade process, Debian may ask you to handle a modified config file. It's generally a good idea to install the package maintainer's version (unless you have a reason not to), then set your custom settings in a separate config file.
The
full-upgrade
part may install further packages that were held back during the normalupgrade
part. Database servers (like MariaDB) are one example.
Step 4: Configure new system
Configure your new system accordingly, such as pointing the nginx sites to the correct updated php-fpm version.
Step 5: Reboot
A reboot is recommended to fully update your operating system and ensure a complete restart of system and services.
sudo reboot