It is always recommended to upgrade the version to prevent any security vulnerability. You can check the current version of your existing Debian version using this command:
# lsb_release -a
As per the above image, Debian 7.8 (Wheezy) is running. Before running any upgrade, it is vital to back up all the data, such as web content, database, and email accounts. You should take a backup at a third-party backup service or an external drive.
We will upgrade Debian OS step by step, upgrading Debian 7 (Wheezy) to 8 (Jessie), then to 9 (Stretch), and then to 10 (Buster).
Upgrade Debian 7 (Wheezy) to 8 (Jessie)
1. Add the following syntax to /etc/apt/sources.list –
deb http://ftp.debian.org/debian/ jessie main
deb-src http://ftp.debian.org/debian/ jessie main
deb http://security.debian.org/debian-security jessie/updates main
deb http://security.debian.org/ jessie/updates main
deb-src http://security.debian.org/ jessie/updates main
# jessie-updates, previously known as 'volatile'
deb http://ftp.debian.org/debian/ jessie-updates main
deb-src http://ftp.debian.org/debian/ jessie-updates main
2. Update the Debian Package using apt-get.
# apt-get update
# apt-get upgrade
3. Click Yes to apply for service restart during the package upgrade.
4. Dist upgrade will update all the packages to the newest available version.
# apt-get dist-upgrade
5. It will ask to disable SSH password authentication for root.
Set it to No.
6. Reboot the server.
7. Enter this command –
# cat /etc/os-release
8. It will yield the output given below that your version is upgraded to Debian 8 (Jessie)
Debian 8 (Jessie) to 9 (Stretch)
1. Replace the below content at /etc/apt/sources.list
deb http://ftp.debian.org/debian/ stretch main
deb-src http://ftp.debian.org/debian/ stretch main
deb http://security.debian.org/debian-security stretch/updates main
deb http://security.debian.org/ stretch/updates main
deb-src http://security.debian.org/ stretch/updates main
# stretch-updates, previously known as 'volatile'
deb http://ftp.debian.org/debian/ stretch-updates main
deb-src http://ftp.debian.org/debian/ stretch-updates main
2. Update Debian 8 (Jessie) before starting the upgrade process.
# apt-get update
3. We will upgrade the version with the below-given command –
# apt-get upgrade
4. Upgrade packages to the new version with dist.
# apt-get dist-upgrade
5. Reboot the server.
6. Enter the command given below –
# cat /etc/os-release
The output below shows that your version has been upgraded to Debian 9 (Stretch) -
Debian 9 (Stretch) to 10 (Buster)
1. Replace the below content at /etc/apt/sources.list
deb http://ftp.debian.org/debian/ buster main
deb-src http://ftp.debian.org/debian/ buster main
deb http://security.debian.org/debian-security buster/updates main
deb http://security.debian.org/ buster/updates main
deb-src http://security.debian.org/ buster/updates main
# buster-updates, previously known as 'volatile'
deb http://ftp.debian.org/debian/ buster-updates main
deb-src http://ftp.debian.org/debian/ buster-updates main
2. Update Debian 9 (Stretch) before starting the upgrade process.
# apt-get update
3. We will upgrade the version with this command –
# apt-get upgrade
4. Upgrade packages to a new version with dist.
# apt-get dist-upgrade
5. Reboot the server.
6. Enter the below-given command –
# cat /etc/os-release
The output below shows that your version has been upgraded to Debian 10 (Buster) -