HugeServer Knowledgebase

How to Upgrade Debian 8 to Debian 9 (Stretch)


After 26 months of development, the Debian project proudly presents the new stable version 9 (code name “Stretch”) which will be supported for 5 years.
In the following section, you can see some of the important changes of Debian, You can read the complete changelog in the Debian (Stretch) release note.

  • Firefox and Thunderbird return to Debian.
  • The X display system no longer requires root privileges.
  • Stretch is the first version of Debian to feature the Modern branch of GnuPG.
  • The UEFI (Unified Extensible Firmware Interface) support first introduced in Wheezy continues to be greatly improved in Stretch.



Backup your important data

We strongly recommend you to backup any data which is important to you, such as:

  • Application codebases
  • Configuration files (Apache, PHP, MySQL)
  • Emails and Email Accounts
  • User account details
  • Databases

We are assuming that you have root permission, otherwise, you may start commands with “sudo”.

Let’s hit the road

Before starting to upgrade your Debian we strongly recommend you to read the release notes so you will be aware of changes you are going to make, For example in Stretch the default MySQL variant is now changed to MariaDB 10.1 and you can’t revert it back, This is one of the many changes that will affect your OS which could be quite interrupting.

Step 1- Update all packages of Debian 8

Before Upgrading to Debian 9 you should update all of Debian 8 packages with the command below:

apt-get update && apt-get upgrade

Step 2- Update your repositories source list

Open the “source.list” with your text editor using the command below:

nano /etc/apt/source.list

Your “source.list” is probably like the following:

deb jessie/updates main
deb-src jessie/updates main

deb jessie-updates main
deb-src jessie-updates main

deb jessie main
deb-src jessie main

Change the red parts (jessie) to “stretch”, you should have something like below:

deb stretch/updates main
deb-src stretch/updates main

deb stretch-updates main
deb-src stretch-updates main

deb stretch main
deb-src stretch main

Step 3- Update all packages again

After you update your “apt” package list, Run the following command the get the “Stretch” packages:

apt-get update && apt-get upgrade

Step 4- Upgrade to Debian 9

Finally, you can upgrade your OS to Debian 9 with the command below:

apt-get dist-upgrade

This command will take some time to complete.

After the upgrading is finished, Reboot your machine with the command below:


Verify Upgrade

Execute the command below and you should see the following output:

lsb_release -a
Distributor ID:	Debian
Description:	Debian GNU/Linux 9.0 (stretch)
Release:	9.0
Codename:	stretch

Execute the following command to remove the remaining useless packages:

apt-get autoremove

Congratulations you have successfully upgraded your Debian 8 to Debian 9!

Was this tutorial helpful?

Thank you for your vote.Thank you for your vote.

Similar Posts

6 thoughts on “How to Upgrade Debian 8 to Debian 9 (Stretch)”

  1. I am using Debian Jessie 8.9 server and want to upgrade to debian stretch. With these command it will upgrade to stretch, or I have to do some thing extra. It will not broke my system.?? Pleae Advise

    1. Hello,

      We cannot guarantee that it will not break your system. Please read the changelog carefully and make sure your applications are supported on Stretch. We also recommend to backup your system before upgrading.


Leave a Reply

Your email address will not be published. Required fields are marked *