โฌ†๏ธHow to upgrade Debian 11 to Debian 12

Discover how to upgrade your Debian 11 system to the latest version, Debian 12, with this comprehensive guide. The article provides step-by-step instructions for preparing your system.

Requirements

  • a VPS

Pre-upgrade Preparation:

  1. Backup Data: Before proceeding with the upgrade, make sure to backup all your important data. Although the upgrade is designed to be smooth, it's always better to be safe.

  2. Update Debian 11: Ensure your Debian 11 system is fully updated by running the following command:

    export DEBIAN_FRONTEND=noninteractive
    sudo apt update && sudo apt -o Dpkg::Options::="--force-confold" dist-upgrade -y
  3. Disable Third-party Repositories: If you have added any third-party repositories to your system, it's recommended to disable them temporarily. You can do this by commenting out or removing their entries in the /etc/apt/sources.list file or the files in the /etc/apt/sources.list.d/ directory.

Upgrading Debian 11 to Debian 12:

  1. Update APT Repository: First, update the APT package repository information to include Debian 12. Edit the /etc/apt/sources.list file and replace occurrences of bullseye with bookworm (the codename for Debian 12).

    sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list
  2. Update Package Lists: After modifying the sources list, update the package lists by running:

    sudo apt update
  3. Upgrade Installed Packages: Once the package lists are updated, upgrade the installed packages to their latest versions with:

    sudo apt upgrade
  4. Start the Distribution Upgrade: Initiate the distribution upgrade by running:

    sudo apt dist-upgrade
  5. Follow On-screen Prompts: During the upgrade process, you may be prompted to confirm package upgrades or resolve conflicts. Follow the on-screen instructions carefully.

  6. Reboot the System: After the upgrade process is complete, it's recommended to reboot your system to apply all changes:

    sudo reboot
  7. Verification: After rebooting, verify that the upgrade was successful by checking the Debian version:

    lsb_release -a

Post-upgrade Steps:

  1. Re-enable Third-party Repositories: If you disabled any third-party repositories earlier, you can re-enable them now.

  2. Clean Up: You can remove obsolete packages and free up disk space by running:

    sudo apt autoremove
    sudo apt clean
  3. Verify Services: Check that all your essential services and applications are functioning correctly after the upgrade.

By following these steps, you should be able to successfully upgrade your Debian 11 system to Debian 12. Remember to exercise caution and back up your data before proceeding with any major system changes.

Last updated