Distro upgrade from Debian Jessie 8 to Stretch 9

Jessie and Stretch character from Pixar Toy Story movie

Upgrade the current version

Check the current version:

cat /etc/debian_version

Update the package index:

apt update

Upgrate to the latest version of Debian Jessie

apt upgrade

Change the package repository to Debian Stretch

Make a copy of the actual repository file:

cp /etc/apt/sources.list /etc/apt/sources.list_backup

Execute apt edit-sources or use your favourite text editor to modify a current /etc/apt/sources.list file to include stretch repositories. Simply update keyword jessie to stretch.

Example from Jessie:

deb http://http.debian.net/debian/ jessie main contrib non-free

to Stretch:

deb http://http.debian.net/debian/ stretch main contrib non-free

Upgrade the distro

Update the package list:

apt update

Then upgrade:

apt upgrade
apt dist-upgrade

Check the new version:

cat /etc/debian_version

Use a single script

#!/bin/sh
apt update
apt -y upgrade
mv /etc/apt/sources.list /etc/apt/sources.list_backup
echo "deb http://http.debian.net/debian/ stretch main contrib non-free" > /etc/apt/sources.list
apt update
apt -y dist-upgrade

Related links