How to upgrade from Debian 10 to Debian 11

2022-02-04 By Nathan 1380 Views linux debian update
0 reviews

Keeping a server up to date with the latest security patches and updates available for the operating system is always a good practice. This helps in protecting the server against any vulnerabilities that were present in the older versions of the operating system.


Debian 11 (Bullseye) is the latest Long Term Support release with the security patches. Hence, upgrading the Debian system with an older to the latest version is always a good option.


This guide outlines the basic steps for upgrading Debian 10 to Debian 11.


IMPORTANT NOTE: Always make sure that the server data is backed up first before proceeding with such upgrade processes as there are high risks of data loss during such operations.


Preparing for the upgrade process


  1. Execute the below command to first check the version of Debian installed in the server.

    # lsb_release -a
    

    debianupgrade1

  2. The initial step to being performed before proceeding with the OS upgrade is to update and upgrade the server packages.


    Run the below command to update and upgrade the packages:

    # sudo apt update && sudo apt upgrade -y
    

    debianupgrade2

  3. Reboot the server once.

    # reboot
    
  4. Once the server is rebooted, run the below command to remove any unused packages and kernels.

    # sudo apt autoremove
    

    debianupgrade12


Change the Debian Sources


  1. Replace all Debian 10 code names with Debian 11 code names in /etc/apt/sources.list file.


    Before that, run the below commands to back up the original configuration files to your home directory.

    # cp /etc/apt/sources.list ~/sources.backup
    
    # cp -r /etc/apt/sources.list.d/ ~/sources.list.d.backup
    

    debianupgrade13

  2. Using any editor of choice, open the /etc/apt/sources.list.

    # vi /etc/apt/sources.list
    


    The current entries should be the same as in the below screenshot:

    debianupgrade4


    Replace those with the below entries, then save and close the file.

    deb http://deb.debian.org/debian bullseye main
    deb http://deb.debian.org/debian bullseye main
    
    deb http://deb.debian.org/debian bullseye main
    deb-src http://security.debian.org/ bullseye/updates main
    
    deb-src http://security.debian.org/ bullseye/updates main
    deb-src http://deb.debian.org/debian bullseye-updates main
    
    deb http://deb.debian.org/debian bullseye-backports main
    deb-src http://deb.debian.org/debian bullseye-backports main
    

    debianupgrade5

  3. Update the package list again with the below command.

    # apt update
    

    debianupgrade6

  4. Run the below command to perform a system upgrade.

    # apt upgrade --without-new-pkgs
    

    debianupgrade7


    After installing the apt-listchanges package, it displays information about the upgraded packages. Type q to exit the pager.

    Also, it will prompt the below screenshot to restart specific services or to keep and erase specific config options. Answer Yes and then press Enter.

    debianupgrade8


Upgrade Debian 10 to 11


  1. Execute the below command for a full upgrade to Debian 11.

    # apt full-upgrade
    

    debianupgrade9


    Configuring openssh-server

    Select the option to keep the local version currently installed:

    debianupgrade10

  2. Reboot the server now.

    # reboot
    
  3. Once the server has been rebooted, log in as root and verify the completion of the upgrade process by checking the current Debian version on the server.

    # lsb_release -a
    

    debianupgrade11


Related Tutorial

What do you think about this article?

Rate this article
LayerStack Promotion
Need assistance?

Try this guide to receive free bundled services at signup on a new free account.

Sign Up

Your Feedback Is Important

We hope you’ll give the new products and updates a try. If you have an idea for improving our products or want to vote on other user ideas so they get prioritized, please submit your feedback on our Community platform. And if you have any questions, please feel free to ask in the Community or contact our Technical Support team.