How to Upgrade Debian 9 to Debian 10

It is important to backup all your data before proceeding with the upgrade so that you can always revert to the previous version if anything goes wrong during the upgrade.

Upgrade all your existing packages

Upgrade all your existing packages.Use the following code to upgrade the packages.

apt update && apt upgrade -y


root@my:~#  apt update &&  apt upgrade -y
Get:1 stretch/updates InRelease [94.3 kB]
Get:2 stretch/updates/main Sources [191 kB]

Modify package repository

Before you change anything, make sure to create a backup,

cp /etc/apt/sources.list /etc/apt/sources.list.bak

Now use sed commands to replace the text 'stretch' with 'buster' in the package repository file

sed -i 's/stretch/buster/g' /etc/apt/sources.list

Now, you need to update the available packages.

apt update

Before starting the upgrade, let's verify the current version using the following command,

cat /etc/*-release


root@my:~# cat /etc/*-release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION="9 (stretch)"

Upgrade to Debian 10

Run the update command,

apt update

This might take a long time to complete due to the number of packges involved in this process!

Once all the packages are updated in your system, then upgrade your distribution packages,

apt dist-upgrade -y

Once the dist-upgrade process id done, reboot the server to boot into the new kernel as well,


Once the server is back online, proceed to the "Verify Upgrade" step below.

Verify Upgrade

Once the upgrade process is completed, reboot your machine and check the version.

lsb_release -a


root@my:~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 10 (buster)
Release:        10
Codename:       buster

Done! Your server is now running Debian 10!