How to update 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

Output:

[email protected]:~#  apt update &&  apt upgrade -y
Get:1 http://security.debian.org/debian-security stretch/updates InRelease [94.3 kB]
Get:2 http://security.debian.org/debian-security 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

Output:

[email protected]:~# cat /etc/*-release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
VERSION_CODENAME=stretch
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

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,

reboot

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

Output:

[email protected]:~# 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!