Upgrade Debian 9 Stretch to Debian 10 Buster



Before getting started, we suggest you Learn Linux Basics and follow these precautions.

Updated: 2019-10-27
Created: 2019-07-06

This guide explains how to upgrade your Debian Linux system from Debian 9 (Stretch) to Debian 10 (Buster) which is now the current stable distribution as of July 6th, 2019.

These steps can be preformed as an in place upgrade on a live system from either a local terminal or remote SSH session.

Step 1

Prior to upgrading, make sure the current system is up-to-date.

apt update && apt upgrade

Step 2

Begin the upgrade by switching Debian repositories from Stretch to Buster. This is accomplished in one of two ways; using the sed command to search and replace all instances automatically, or by editing the source file manually. Choose whichever option you prefer.

Search & Replace with sed.

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

Or edit your source list manually.

vi /etc/apt/sources.list

Replace all instances of "stretch" with "buster", for example.

deb http://deb.debian.org/debian stretch main
deb-src http://deb.debian.org/debian stretch main

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

deb http://deb.debian.org/debian stretch-updates main
deb-src http://deb.debian.org/debian stretch-updates main

Becomes.

deb http://deb.debian.org/debian buster main
deb-src http://deb.debian.org/debian buster main

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

deb http://deb.debian.org/debian buster-updates main
deb-src http://deb.debian.org/debian buster-updates main

Note: Debian is distributed (mirrored) on hundreds of servers worldwide. In our source.list example above we've used a repository within the United States, to speed up downloads you may choose another Debian mirror based on geographic location.

Step 3

Update the package index.

apt update

Step 4

Upgrade the minimal base system.

apt upgrade

Step 5

Upgrade all other packages and dependencies.

apt dist-upgrade

Step 6

Reboot the system.

reboot

Step 7

Verify your release has been upgraded.

lsb_release -a

Output will be similar to this.

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

Step 8

Clear out the local repository of retrieved package files and dependencies that are no longer required.

apt clean

apt autoremove