Hello Post4VPS Community
I would like to share the follow account of experience and a brief guide about how to upgrade Debian 9 to Debian 10 in a few easy steps. First I'd like to explain why I'm posting this. I have been taking part in the December giveaway and won a VPS. In my applicaton I requested the OS Debian 10 to be installed on the VPS and noted that Debian 9 can be installed if Debian 10 is not available. So it looks like Debian 10 was not available but thankfully Debian 9 was installed for me. I decided to upgrade Debian 9 to Debian 10 myself. Here is how I did i in a few steps.
Warning: Debian might be generally a very stable OS but distribution upgrades are something that can be rated as dangerous and should be handled with care. I don't recommend to dist upgrade a long running server with applications and other things already running on it. Even if you decide to do so take backups! Things could go wrong and the server could be rendered unusable! Therefore I would like to explain that I'm not responsible for any damage that might happen to any server when performing a distribution upgrade. I recommend only to do this on a fresh installed Debian 9 VPS where you have nothing to lose!
Let's get started with the guide.
1. Login into your Debian 9 VPS as root or a user that can use sudo via SSH or any other different way (direct TTY, emergency SSH, VNC or whatever else you have available).
2. First you have to get the current system up to date. To do so run the commands below in the order given.
apt-get update
apt-get upgrade -y
apt-get dist-upgrade -y
(Don't forget to apply sudo before the commands if you use a non root user!)
- The first command will update the package database on your machine which in return will compose a list of packages that can be updated.
- The second command will actually update the packages that have updates available for them.
- The third command will update some packages that have been hold back like the kernel and firmware.
Everything on the current system has to be up to date to avoid possible issues with package version mismatch and other things that can happen when you skip ahead package versions during updates.
3. Take a backup of your sources.list by using the command below.
cp /etc/apt/sources.list /etc/apt/sources.list.backup
(Don't forget to apply sudo before the commands if you use a non root user!)
4. Open the /etc/apt/sources.list file, wipe all the content in it and paste the following Debian 10 package sources into the file using a text editor like nano, vi or vim. When opening the file don't forget to use sudo if you use a non root user account.
Debian 10 package sources:
deb http://httpredir.debian.org/debian buster main
deb http://httpredir.debian.org/debian buster-updates main
deb http://security.debian.org buster/updates main
5. Update the package database again and finally upgrade all packages and kernel to Debian 10 level by using the commands below.
apt-get update
apt-get upgrade -y
apt-get dist-upgrade -y
(Don't forget to apply sudo before the commands if you use a non root user!)
You might notice that this are the commands as from a few steps ago. So it's really that simple to perform the upgrade after changing the package sources.
You will be asked if you want to restart system services automatically or manually. Simply choose to restart all necessary services automatically. This will simply save you some work and steps.
6. After all packages have been upgraded to Debian 10 you can do a little clean up. To clean up no longer needed packages and files run the command below.
apt-get --purge autoremove -y
(Don't forget to apply sudo before the commands if you use a non root user!)
7. Finally restart your server to boot into the new Debian 10 kernel and you are done with the upgrade.
This has worked flawless for me. I'm not running Debian 10 on my VPS 16. In the paste I upgraded Debian 8 to Debian 9 to Debian 10 on a NanoKVM VPS without any issues.
This is one way to get the latest Debian version if your provider doesn't provide it or you don't want to reinstall your OS again.