How to Upgrade Debian 8 Jessie to Debian Linux 9 Stretch

Introduction

Debian is one of the main forks, or distributions, of the Linux operating system. There are many derivatives of Debian Linux, like Ubuntu and Kali. Debian remains a popular and well-supported Linux operating system. As such, updates are released often.

This guide will walk you through upgrading Debian 8 (Jessie) to the next version, Debian 9 (Stretch).

how to upgrade from debian 8 to debian 9

Prerequisites

  • A system with Debian 8 installed
  • Access to a Debian user account with sudo privileges (Alternately, access to a root user account if sudo is not installed)
  • Access to a command-line/console window (CtrlAltF1)

Upgrade to Debian Version 9 Stretch

Step 1: Prepare to Upgrade

Upgrading to the current major version can be risky as it may destabilize your system. The following instructions will prepare it for a safe upgrade:

1. Upgrade the operating system in a test environment before rolling it out in a production environment.

2. Back up your data before running the upgrade.

3. Remove 3rd-party and outdated software repositories. Enter the following command into a console window to do so:

sudo aptitude search “~o”

Note: The default MySQL database application in Debian 8 has been replaced with MariaDB. Functionally, there is very little difference between MariaDB and MySQL. Plus, the upgrade process will convert your databases to the new format. However – the new database format is not backward-compatible with the older MySQL system yet. If your upgrade fails, you may need to import database files from a backup.

Step 2: Update Package Manager and Repositories

As with any software update or installation, it is highly recommended to update the local software lists. These steps ensure that your package manager is pointed at the latest and best-patched versions of the software. Also, they assure your installed software is at its most recent release, and therefore the most likely to be compatible after your upgrade.

1. To update the package repository, enter the following command in the terminal:

sudo apt-get update

2. Next, install software updates:

sudo apt-get upgrade

3. Finally, run any available operating system updates. In a console window, use the command:

sudo apt-get dist-upgrade

Step 3: Upgrade from Debian Jessie 8 to Debian 9

To upgrade to version 9 of Debian, you will need to edit the apt sources.list file.

1. In a console window, modify the sources file by entering:

sudo nano /etc/apt/sources.list

You should see a list of web addresses that list “jessie”.

2. Replace the content of this file with the following:

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

The new file contents should refer to “stretch” instead of “jessie”. Save the file and exit.

3. Update the local software lists from the new repository lists:

sudo apt-get update

4. Next, install the base packages by running the following command:

sudo apt-get upgrade

5. Run the full operating system upgrade with the following:

sudo apt-get dist-upgrade

6. Debian 9 includes an upgrade to a newer version of the Linux kernel, and this process requires a reboot. If your system doesn’t restart as part of the upgrade, reboot your system manually from the console with: reboot

Step 4: Verify Debian Upgrade

Confirm or check successful upgrade by running the command:

cat /etc/os-release

The output should appear as below:

PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Step 5: Post-upgrade Cleanup

The apt package manager will do most of the cleanup work for you. You can finish removing packages that are no longer needed with the command:

sudo apt-get autoremove

Conclusion

Now you have Debian Jessie Linux upgraded to Debian Stretch on your server. By following this tutorial, you should now have a fully functioning and upgraded Debian 9 operating system.

After the upgrade, run the system through its paces by checking common system functions and frequently used applications.

Was this article helpful?
YesNo
Goran Jevtic
Goran combines his leadership skills and passion for research, writing, and technology as a Technical Writing Team Lead at phoenixNAP. Working with multiple departments and on various projects, he has developed an extraordinary understanding of cloud and virtualization technology trends and best practices.
Next you should read
How to Install and Secure phpMyAdmin on Debian 9
April 15, 2020

This guide is for users who are running a Debian 9 server with Apache, MySQL, and PHP. The phpMyAdmin...
Read more
How To Install Debian 10 (Buster)
October 14, 2019

Debian has released its newest stable version Debian 10, nicknamed Buster. The latest release includes many...
Read more
How to upgrade Debian 9 Stretch to Linux Debian 10 Buster
March 29, 2019

Debian 10, codenamed Buster, is still a work in progress, but a pre-release version is available. Even though...
Read more
How to Install Apache Maven on Debian 9
March 24, 2019

Apache Maven is a project management tool for developing Java applications It resembles other Linux-based...
Read more