Upgrade Debian 9 Stretch to Debian 10 Buster
This guide explains how to upgrade your Debian Linux system from Debian 9 (Stretch) to Debian 10 (Buster) which is now the current stable release 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.
Prior to upgrading, make sure the current system is up-to-date.
apt update && apt upgrade
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.
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
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
If you also need the contrib and non-free components, add contrib non-free after main on all lines.
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.
Third-party software that is installed from Personal Package Archives (PPA) will be disabled during the upgrade process. This may not be applicable to your system, so prior to starting, identify PPA by looking for .list files in the /etc/apt/sources.list.d/ directory. If present, you'll need to update these once the system upgrade has finished. Check with the software distributor on how to do this as software channels outside the standard Debian repositories may not support this new release.
Update the package index.
Upgrade the minimal base system.
Upgrade all other packages and dependencies.
Reboot the system.
Verify your release has been upgraded.
Output will be similar to this.
No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 10 (buster) Release: 10 Codename: buster
Clear out the local repository of retrieved package files and dependencies that are no longer required.