Upgrade Debian 9 to Debian 10 is very similar to upgrading previous versions. The only you need to do is change the sources to Buster instead of Stretch. If you know how to do it, just scroll down and copy the sources. The instructions in this article assume root. You can not delete sources.list with sudo.
Long time support for Debian 9 is expected to last until June 2022. So there is no rush to update. But since Debian 10 has been out for more than half a year, so why not.
Warning: Before updating you should make a backup unless you have nothing of importance on your system. A quick backup tips if you are running Debian 9 on VirtualBox, is to just take a snapshot. For some applications like MySQL and Apache, and probably lots of others, it is a good idea to keep your current configs instead of using the package maintainers config. That will most likely mess up your installation. So please make a backup before you proceed.
To verify your Debian version, you can check the /etc/debian_version
cat /etc/debian_version
9.12
You can also check the kernel version. You do that by running uname -a.
uname -a
Linux web 4.9.0-9-amd64 #1 SMP Debian 4.9.168-1+deb9u5 (2019-08-11) x86_64 GNU/Linux
Before doing any upgrades, it is a good idea to update your packages first.
apt update
apt upgrade
With your system up to date on packages, it is time to upgrade to Debian 10. The first thing we do is to delete the sources.list file. You can delete the content and keep the file by doing:
> etc/apt/sources.list
With an empty sources.list, you can just copy the sources below and paste them into your own sources. Open your favorite text editor and paste in the sources.
deb http://ftp.debian.org/debian/ buster main contrib non-free
deb-src http://ftp.debian.org/debian/ buster main contrib non-free
deb http://security.debian.org/ buster/updates main contrib
deb-src http://security.debian.org/ buster/updates main contrib
deb http://ftp.debian.org/debian/ buster-updates main contrib non-free
deb-src http://ftp.debian.org/debian/ buster-updates main contrib non-free
Now we will need to upgrade the packages to Debian 10.
apt update
apt upgrade
With updated packages, we can upgrade the distro.
apt dist-upgrade
Your system is now updated. But you will have a lot of outdated packages you can remove.
apt autoremove
Reboot your system and verify the kernel again with uname -a. It should show a newer version than previously. You can also check the /etc/debian_version file.
After the upgrade I have this kernel:
Linux web 4.19.0-8-amd64 #1 SMP Debian 4.19.98-1 (2020-01-26) x86_64 GNU/Linux
So this is how to upgrade Debian 9 to Debian 10. Enjoy your updated system. Debian 10 LTS will probably be around until 2024.
If you are looking to Upgrade Debian 8 to Debian 9.
Enjoy!