Debian 9 Stretch was released as the latest stable version of the Linux Debian operating system. While you can install Debian 9 Stretch fresh, you can also perform an in place upgrade from Debian 8 Jessie quite easily, which is what we will cover here.
It is recommended that you have your Debian 8 Jessie installation completely up to date before starting, to do this run “apt-get update” followed by “apt-get upgrade” and install available updates.
Edit the /etc/apt/sources.list file, my file is shown below. As you can see all of the lines are currently specifying “jessie”. Note that your mirror sources will likely be different which is fine.
deb http://debian.uberglobalmirror.com/debian/ jessie main
deb-src http://debian.uberglobalmirror.com/debian/ jessie main
deb http://security.debian.org/ jessie/updates main contrib
deb-src http://security.debian.org/ jessie/updates main contrib
# jessie-updates, previously known as 'volatile'
deb http://debian.uberglobalmirror.com/debian/ jessie-updates main contrib
deb-src http://debian.uberglobalmirror.com/debian/ jessie-updates main contrib
Change the instances of “jessie” to “stretch”, you can either do this manually, or automatically with the below sed command.
sed -i 's/jessie/stretch/g' /etc/apt/sources.list
The recommended way to upgrade Debian is with the ‘apt-get’ command. First update the list of available packages with the below command, as we’ve just updated the sources.list file.
Now that the list of available packages has been updated from the mirror, run the below command to perform a minimal upgrade.
This is known as a minimal system upgrade as it only upgrades packages that can be upgraded without needing any other packages to be removed or installed, so it’s a safe place to start. This upgraded 932 packages requiring 412MB on my system.
Now you’re ready to do the complete system upgrade, this will upgrade to the latest available version for all packages installed.
Ensure that you have enough free disk space to complete the operation, in my case it notes that afterwards 1,048MB of additional disk space will be used with 639 package upgrades and 479 newly installed packages.
Once the upgrade has completed you may have packages that can be removed and are no longer required, you’ll see these when trying to use apt-get upgrade. We can clean these out by running “apt-get autoremove”.
This cleaned 496MB of packages from my system that were identified as no longer being required after the upgrade.
All that’s left to do is perform a reboot of the system, this is required as the kernel version has been updated. This can be done by simply entering “reboot” in the terminal.
root@debian8:~# uname -a
Linux debian8 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2 (2017-04-30) x86_64 GNU/Linux
After Upgrade and System Reboot:
root@debian8:~# uname -a
Linux debian8 18.104.22.168-amd64 #1 SMP Debian 4.9.30-2 (2017-06-12) x86_64 GNU/Linux