How Do I Upgrade My Server From Debian 11 to Debian 12?

How do I upgrade my server from Debian 11 to Debian 12?

You can follow the steps below to upgrade your server from Debian 11 to Debian 12:

  1. Make a snapshot or backup of your server to make sure no data is lost. You can find a guide on how to create a snapshot here and a guide on how to create a backup here.

  2. First you need to remove any non-Debian packages from your server, you can run the following command to find all of the non-Debian packages:
    sudo apt list '?narrow(?installed, ?not(?origin(Debian)))'
    sudo apt-forktracer | sort
    
  3. Next you need remove all packages with the hold status, you can run the following command to find all the packages with the hold status:
    sudo apt-mark showhold | more
  4. Then you can run the following command to delete all the packages with the hold status:

    sudo apt-mark unhold [package_name]
  5. Next you need to make sure all packages and repositories are up to date by running the following command:

    sudo apt update && sudo apt upgrade
  6. Next you will need to update the APT's source list files. First change the directory to etc/apt with the following command:

    cd /etc/apt
  7. Open the sources.list file using your preferred text editor. In the example we will use nano: 
    sudo nano sources.list
  8. Using the text editor replace any sources that contain the word "bullseye" with "bookworm" for example "deb http://deb.debian.org/debian bullseye" main to "deb http://deb.debian.org/debian bookworm main".


  9. Run the following command to update the system repositories:
    sudo apt update
  10. When prompted to restart service packages, select Yes using the arrow keys and press Enter.

  11. Run the following command to restart the system to complete the upgrade process:  
    systemctl reboot
  12. After the reboot you can check the version by running this command:
    cat /etc/debian_version

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article

Modified on Mon, 1 Jul at 8:42 AM

Can’t find what you’re looking for?

Get in Touch

Do you have a pre-sales question?