Article

Table of Contents
Theme:
Was this article helpful?

1  out of  1 found this helpful

Try Vultr Today with

$50 Free on Us!

Want to contribute?

You could earn up to $600 by adding new articles!

How to Upgrade from Debian 10 to Debian 11

Author: Humphrey Mpairwe

Last Updated: Fri, Jan 7, 2022
Debian System Admin

Debian 11 (Bullseye) is the new stable version of the Debian Linux operating system, which offers a wide range of updated software packages. Best of all, it comes with five years of support. This article explains how to upgrade an existing Debian 10 server to Debian 11.

Step 1: Update Existing Server Packages

  1. SSH to the server as a regular user with sudo privileges.
  2. It's good practice to update your existing server packages, security patches, and necessary upgrades before making the switch from Debian 10 to ensure your applications are compatible with Debian 11.
  3. Update the available packages.

    $ sudo apt update
    
  4. Upgrade all the existing packages.

    $ sudo apt upgrade
    
  5. Remove any unnecessary dependency files.

    $ sudo apt autoremove
    

Step 2: Back Up the Server

Before upgrading to Debian 11, make a backup of your current server status in case things go wrong. You can do this by creating a snapshot of your server.

  1. Log in to your Vultr account.
  2. Select Snapshots from the Products menu.
  3. Click Add Snapshot, then choose your target server.
  4. Assign a custom label.
  5. Click Take Snapshot to begin the backup process.

The snapshot process will start, and depending on your server size, it may take between five and ten minutes to complete. When finished, the status changes from pending to available.

snapshot

Step 3: Change the Debian Sources

Aptitude (Apt) downloads packages from one or more repositories for installation on your server. It finds the correct repositories, available packages, and versions to download in /etc/apt/sources.list. So, you need to replace all Debian 10 codenames with Debian 11 codenames in /etc/apt/sources.list.

  1. Confirm the Debian 10 codename by running the following command. Debian 10 is codenamed buster.

    $ lsb_release -a
    

    Your output should be:

    No LSB modules are available.
    Distributor ID: Debian
    Description: Debian GNU/Linux 10 (buster)
    Release: 10
    Codename: buster
    
  2. Change all buster entries in the sources list to bullseye, which is the codename for Debian 11.

  3. Back up the original configuration files to your home directory.

    $ sudo cp /etc/apt/sources.list ~/sources.bak
    $ sudo cp -r /etc/apt/sources.list.d/ ~/sources.list.d.bak
    
  4. Open /etc/apt/sources.list in your favorite editor.

    $ sudo nano /etc/apt/sources.list
    
  5. The current entries should look like this:

    deb http://deb.debian.org/debian/ buster main
    deb-src http://deb.debian.org/debian/ buster main
    
    deb http://security.debian.org/debian-security buster/updates main
    deb-src http://security.debian.org/debian-security buster/updates main
    
    # buster-updates, previously known as 'volatile'
    deb http://deb.debian.org/debian/ buster-updates main
    deb-src http://deb.debian.org/debian/ buster-updates main
    

    Replace those lines with:

    deb http://deb.debian.org/debian bullseye main
    deb-src http://deb.debian.org/debian bullseye main
    
    deb http://security.debian.org/ bullseye-security main
    deb-src http://security.debian.org/ bullseye-security main
    
    deb http://deb.debian.org/debian bullseye-updates main
    deb-src http://deb.debian.org/debian bullseye-updates main
    
  6. Save and close the file.

  7. Update the package list a second time. If you made the changes correctly, there won't be any errors displayed during the update process.

    $ sudo apt update
    
  8. Perform a system upgrade. Use the --without-new-pkgs flag to avoid removing the packages you intend to keep on your server.

    $ sudo apt upgrade --without-new-pkgs
    

    You will be prompted to restart specific services or to keep and erase specific config options. Answer yes.

  9. After the apt-listchanges package is installed it will display information about the upgraded packages. Type Q to exit the pager.

  10. Select a console encoding set, and continue with other upgrades.

Step 3: Upgrade Debian

Now you can safely run a full upgrade to Debian 11 with the following command:

$ sudo apt full-upgrade 

This will run a full upgrade of the server from Debian 10 to Debian 11, resolve possible dependencies changes, install the newest versions of all packages, and remove any obsolete packages. During the system upgrade process, additional prompts may be displayed to restart services and update existing configuration options. Be sure to select appropriate choices to avoid unwanted changes to existing applications.

When a pager indicator : is displayed, type Q to continue.

Type Y when prompted to modify /etc/sysctl.conf.

Configuration file '/etc/sysctl.conf'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ? Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.

Step 4: Reboot the Server

  1. After the system upgrade is complete, restart your server for changes to take effect.

    $ sudo reboot now
    

    Your current SSH connection will be dropped.

  2. Wait for a minute for the server to reboot.

  3. Log in through SSH.
  4. Check the current operating system version and verify it shows Debian 11, bullseye.

    $ lsb_release -a
    

    Output:

    No LSB modules are available.
    Distributor ID: Debian
    Description: Debian GNU/Linux 11 (bullseye)
    Release: 11
    Codename: bullseye
    

Step 5: Verify Applications and Services

Some packages may have been upgraded to newer versions during the upgrade process, but they will still use the same configuration files and ports. Verify your existing apps one by one and also check the error logs depending on your server setup. For instance, check whether Apache2 is installed and running:

$ sudo service apache2 status

To confirm if MySQL is present:

$ sudo service mysql status

To check your current PHP version:

$ php -v

Step 6: Secure the Server

Several applications may need new versions during the upgrade from Debian 10 to Debian 11. Depending on your installation type, some may have been automatically updated during the process, or you may have to update the latest versions manually. To secure the server, remove any outdated packages.

$ sudo apt --purge autoremove

Confirm if the Uncomplicated Firewall (ufw) is running and set some rules to tighten connections to your server.

$ sudo ufw status

To allow a service like HTTP, run:

$ sudo ufw allow http

Conclusion

Congratulations, you have successfully upgraded your server from Debian 10 "Buster" to Debian 11 "Bullseye" and retained existing applications on the server. Typically, you should expect about 15 minutes of downtime.

For more information, see these articles at debian.org.

Want to contribute?

You could earn up to $600 by adding new articles