How To Upgrade from Debian Jessie to Debian Stretch

How To Upgrade from Debian Jessie to Debian Stretch

I like to keep up to date with the latest software. I am usually an early adopter of operating systems, particularly beta releases. Now that Debian 9 ‘Stretch’ has officially been released, you may be interested in upgrading your Debian operating system to the latest version. In this guide, I will explain the few steps needed to upgrade from Debian 8 ‘Jessie’ to Debian 9 ‘Stretch’.

The first step is ensuring that everything is fully up-to-date with your current operating system. This could help make the process run a little smoother, especially if you are upgrading from an out-of-date package.

Run the following commands:

apt-get update
apt-get upgrade
apt-get dist-upgrade

You may also want to see if any packages have errors, are obsolete or missing. To do this, you can run the following:

dpkg -C

If the previous command comes back clean, then check to make sure there are no held packages:

apt-mark showhold

Once you are happy with upgrading your current packages, you will upgrade your package sources to look for Stretch repositories instead of Jessie. To do this, you need to replace instances of ‘Jessie’ in your /etc/apt/sources.list file to ‘Stretch’.

To do this, simply edit the /etc/apt/sources.list file and replace ‘Jessie’ with ‘Stretch’.

Original

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

Edited

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

You may want to look through the other files in your /etc/apt folder (if you have any), and update those sources too.

Now you have updated the source lists, you can now perform the upgrade to ‘Stretch’.

We’ll do the following. Update the databases to the latest sources and upgrade installed applications. Then we’ll perform a distribution upgrade to get the latest kernel modules and other useful upgrades.

apt-get update
apt-get upgrade
apt-get dist-upgrade

You may be asked various questions throughout. Most likely, you will be asked what to do with configuration files. The default is to keep existing configurations. However, it is recommended to back up your existing configurations and install the new configuration. This will install the new configuration file for the specific version of the package you are installing, thus reducing risks of completely breaking the package.

Once the dist-upgrade has completed, you must reboot in order to use the latest kernel.

You may wish to clean out redundant caches and kernels after this upgrade by running the following:

apt-get clean
apt-get autoremove

You can double check which version of Linux you are using by typing lsb_release -a

Well done. You’ve now upgraded from Debian 8 ‘Jessie’ to Debian 9 ‘Stretch’.

About Daniel Hand

I am a WordPress developer, systems engineer and founder of SpeakWP from England. I make themes, plugins, love drinking coffee and want to make the web better for everyone.

    Follow Me: