Upgrade Debian 8 (Jessie) to Debian 9 (Stretch)

Published on: Fri, Aug 4, 2017 at 12:37 pm EST
Debian Linux Guides System Admin

Debian 9 codename Stretch is the latest stable release of Debian, which was released on June 17, 2017. In this tutorial, I am going to show you how to upgrade your Debian 8 (Jessie) server to the latest stable release.

What's new in this release?

  • Over 15,000 new packages, for a total of over 51,000 packages. Read more.
  • Over 50% of all packages were updated.
  • MariaDB replaces MySQL. Note that binary data file formats are not backwards compatible after upgrading. Read more.

Step one - Preparation

Debian is an extremely stable operating system and upgrading from one release to another has always been easily performed. To be on the safe side, I strongly recommend that you make a full backup or at least backup any data or configuration information you can't afford to lose. The Vultr snapshot system can be used for easy backup and restore.

This is also a good time to check for broken packages:

sudo dpkg --audit

Step two - System update

Update the system to the latest version.

apt update
apt upgrade

Once upgraded, you will see the following output.

Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Step three - Upgrade to Stretch

Make a copy of your original /etc/apt/source.list file.

cp /etc/apt/sources.list /etc/apt/sources.list-jessie

Now edit the file and replace the words jessie with stretch.

deb http://security.debian.org/ stretch/updates main contrib non-free

deb-src http://security.debian.org/ stretch/updates main contrib non-free

deb http://ftp.uk.debian.org/debian/ stretch-updates main contrib non-free

deb-src http://ftp.uk.debian.org/debian/ stretch-updates main contrib non-free

deb http://ftp.uk.debian.org/debian/ stretch main contrib non-free

deb-src http://ftp.uk.debian.org/debian/ stretch main contrib non-free

Re-run system update and this time run dist-upgrade.

 apt update
 apt upgrade
 apt dist-upgrade

After the upgrade is done, you can remove unnecessary packages.

 apt autoremove

Step four - Boot into the new system

Reboot the system.

reboot

After the system comes back up, login in and check the Debian version.

cat /etc/debian_version

9.1

... or check the kernel version.

uname -a

Linux mydebian 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u2 (2017-06-26) x86_64 GNU/Linux

Conclusion

Upgrading a Debian system in place from Jessie to Stretch is an easy process, but keep in mind that before you decide to do it, you must check any possible third-party applications for compatibility issues.

Want to contribute ?

You could earn up to $300 by adding new articles