Debian – How to upgrade to Debian 9
In this article, we will show you how to upgrade from Debian 7 (wheezy) to Debian 9 (stretch)
1. Debian code name
First, understand the Debian code name, read this Debian releases
Debian 9 (stretch)
Debian 8 (jessie)
Debian 7 (wheezy)
Debian 6 (squeeze)
P.S On Debian 7, first upgrade to Debian 8, then Debian 9, we must follow the correct order to upgrade Debian.
2. Upgrade Debian 7 to Debian 8
2.1 On Debian 7, make sure everything is up to date.
$ cat /etc/debian_version
7.5
$ sudo apt-get update
$ sudo apt-get upgrade
2.2 Edit /etc/apt/sources.list
. The server urls is vary depending on your hosting provider. it’s fine, we just want to update the Debian 7 code name (wheezy).
deb http://mirrors.linode.com/debian/ wheezy main
deb-src http://mirrors.linode.com/debian/ wheezy main
deb http://mirrors.linode.com/debian-security/ wheezy/updates main
deb-src http://mirrors.linode.com/debian-security/ wheezy/updates main
deb http://mirrors.linode.com/debian/ wheezy-updates main
deb-src http://mirrors.linode.com/debian/ wheezy-updates main
P.S This example is tested under a Linode server.
2.3 Update /etc/apt/sources.list
to Debian 8 code name (jessie).
deb http://mirrors.linode.com/debian/ jessie main
deb-src http://mirrors.linode.com/debian/ jessie main
deb http://mirrors.linode.com/debian-security/ jessie/updates main
deb-src http://mirrors.linode.com/debian-security/ jessie/updates main
deb http://mirrors.linode.com/debian/ jessie-updates main
deb-src http://mirrors.linode.com/debian/ jessie-updates main
2.4 Save and exit, do the normal update and upgrade process.
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get dist-upgrade
2.5 Restart the server. Done. The Debian is upgraded from 7 to 8.
# Restart the server
$ sudo reboot
$ cat /etc/debian_version
8.x
2.6 Post upgrade.
# remove unused packages.
$ sudo apt-get autoremove
3. Upgrade Debian 8 to Debian 9
The process is the same like an upgrade from Debian 7 to 8.
3.1 Make sure everything is up to date.
$ cat /etc/debian_version
8.x
$ sudo apt-get update
$ sudo apt-get upgrade
3.2 Update /etc/apt/sources.list
to Debian 9 code name (stretch).
deb http://mirrors.linode.com/debian/ stretch main
deb-src http://mirrors.linode.com/debian/ stretch main
deb http://mirrors.linode.com/debian-security/ stretch/updates main
deb-src http://mirrors.linode.com/debian-security/ stretch/updates main
deb http://mirrors.linode.com/debian/ stretch-updates main
deb-src http://mirrors.linode.com/debian/ stretch-updates main
3.3 Update and upgrade.
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get dist-upgrade
3.4 Restart the server. Done. The Debian is upgraded from 8 to 9.
# Restart the server
$ sudo reboot
$ cat /etc/debian_version
9.5
4. FAQs
4.1 Some /etc/apt/sources.list
examples.
Debian 9 (stretch)
deb http://httpredir.debian.org/debian stretch main
deb http://httpredir.debian.org/debian stretch-updates main
deb http://security.debian.org stretch/updates main
Debian 8 (jessie)
deb http://httpredir.debian.org/debian jessie main
deb http://httpredir.debian.org/debian jessie-updates main
deb http://security.debian.org jessie/updates main
Debian 7 (wheezy)
deb http://httpredir.debian.org/debian wheezy main
deb http://httpredir.debian.org/debian wheezy-updates main
deb http://security.debian.org wheezy/updates main
4.2 What will happen to the things that already installed/configured? Can they break?
A: Yes, it may, during the upgrade process, if the System found any conflicts, it will prompt you and ask you what should do next, keep the old file or replace with the latest. After upgraded, just test every core services like Nginx, Apache, MySQL, etc, to make sure they are running fine.
After the steps 2.4 above and reboot my computer, it only shows the desktop with no other interactions at all, no icons and the full desktop is just a wallpaper, what should I do 🙁 ? Thanks for the reply.