How To Upgrade Debian 8 Jessie to Debian 9 Stretch

Upgrade Debian 8 Jessie to Debian 9 Stretch
Upgrade Debian 8 Jessie to Debian 9 Stretch

Debian 9 Stretch has been released on 17th June 2016, and you may be now looking for upgrading your previous version, i.e., Debian 8 “Jessie” to the latest version Debian 9 “Stretch“.

This post will guide you through the steps to upgrade your system from Debian 8 “Jessie” to Debian 9 “Stretch”.


You need to have an active internet connectivity to download the latest updates.

You must have root or sudo privileges to perform this OS upgrade.

Test this OS upgrade on Development systems before upgrading the Production systems.


Before proceeding to upgrade, request you to take a full backup of important data files and configurations as this may help us restoring the system back to its previous state if you face any issues during the upgrade.


  • Databases
  • Configuration files
  • Important application data files

Verify the current version:

Use “lsb_release -a” command to see the current version of Debian.

Distributor ID: Debian
Description: Debian GNU/Linux 8.8 (jessie)
Release: 8.8
Codename: jessie

Update all the packages of Debian 8:

Use the following command to update all the installed packages to the latest package available for the current operating system, i.e., Debian 8 “Jessie”.

apt-get update; apt-get upgrade

Modify /etc/apt/sources.list repository file:

Now edit the Debian apt configuration  file “/etc/apt/sources.list” and replace “jessie” with “stretch“. Safer side, take a backup of current sources.lits file.

cp /etc/apt/sources.list /etc/apt/sources.list_bkp

Use “sed” command to update the repository file.

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

The file will look like below after updating it with “stretch

deb stretch main
deb-src stretch main

deb stretch/updates main
deb-src stretch/updates main

deb stretch-updates main
deb-src stretch-updates main

Update the package index.

apt-get update

Preview the upgrade:

Use “apt list –upgradable” command to quickly see what will be installed, updated, and removed during the upgrade process without affecting the system.

apt list --upgradable

Sample Output:

unattended-upgrades/stable 0.93.1+nmu1 all [upgradable from:]
util-linux/stable 2.29.2-1 amd64 [upgradable from: 2.25.2-6]
uuid-runtime/stable 2.29.2-1 amd64 [upgradable from: 2.25.2-6]
vim/stable 2:8.0.0197-4 amd64 [upgradable from: 2:7.4.488-7+deb8u3]
vim-common/stable 2:8.0.0197-4 amd64 [upgradable from: 2:7.4.488-7+deb8u3]
vim-runtime/stable 2:8.0.0197-4 all [upgradable from: 2:7.4.488-7+deb8u3]
vim-tiny/stable 2:8.0.0197-4 amd64 [upgradable from: 2:7.4.488-7+deb8u3]

Upgrade to Debian 9 “Stretch”:

Now, update all packages on your system to the latest version available for Debian 9 “Stretch”.

apt-get upgrade

During the package update, you may be asked whether to keep the locally available configuration file intact or replace with the file coming from updated package. Recommendatins is to “keep the local version currently installed“.

Upgrade Debian 8 Jessie to Debian 9 Stretch - Configuration Files
Upgrade Debian 8 Jessie to Debian 9 Stretch – Configuration Files

Do the distribution upgrade to complete the upgradation to Debian 9.

apt-get dist-upgrade

During the distribution upgrade, services installed on your system needs to be restarted after up gradation of each service packages (ex. Apache, NTP) which may cause you the service interruptions. You can choose to restart automatically during upgrade or manually after the upgrade. Here, I opted to do “an automatic restart of services during the OS upgrade“.

Upgrade Debian 8 Jessie to Debian 9 Stretch - Restarting services
Upgrade Debian 8 Jessie to Debian 9 Stretch – Restarting services

Verify upgrade:

Reboot your machine after the distribution upgrade.


Verify the current version of Debian operating system.

lsb_release -a


Distributor ID: Debian
Description: Debian GNU/Linux 9.0 (stretch)
Release: 9.0
Codename: stretch

That’s All.

You might also like