How to upgrade Debian Wheezy to Jessie safely
This tutorial exists for these OS versions
- Debian 11 (Bullseye)
- Debian 10 (Buster)
- Debian 9 (Stretch)
- Debian 8 (Jessie)
- Debian 7 (Wheezy)
- Debian 6 (Squeeze)
On this page
This tutorial explains the upgrade procedure to upgrade Debian from Wheezy to Jessie in a few simple steps.
Before you start with the upgrade, backup all critical data. Thats especially the config data in the /etc directory and the user data in /home. When you run a server then you should include the databases (MySQL, Postgresql, etc), web and email data in the backup as well. The backup should be stored on a external harddisk, on an external server e.g. by FTP or on a cloud drive. Here are a few examples on how to create backups with tar.
Backup the configuration and data
Configuration files in the /etc directory.
tar -pczf etc.tar.gz /etc
Backup of the /var/www website directory.
tar -pczf www.tar.gz /var/www
Backup of the /home directories.
tar -pczf home.tar.gz /home
For ISPConfig 3 users: Backup of your email server files.
tar -pczf vmail.tar.gz /var/vmail
Backup MySQL databases
mysqldump --defaults-file=/etc/mysql/debian.cnf -cCeQ --hex-blob --quote-names --routines --events --triggers --all-databases -r all_databases.sql
Then move the tar.gz and .sql files for safe storage on a backup drive.
Check the apt sources.list file
We will install all available Wheezy updates first before we upgrade to Jessie. On some systems the package source is defined as "stable" in the sources.list file instead of "wheezy" or "jessie". To avoid an accidential early upgrade to Jessie, please check the sources.list now and ensure that it contains "wheezy" and not "stable" as source:
Use a commandline editor like nano or vi to open /etc/apt/sources.list, the lines should be similar to the ones below:
deb http://ftp.de.debian.org/debian wheezy main contrib non-free
deb-src http://ftp.de.debian.org/debian wheezy main contrib non-free
deb http://ftp.de.debian.org/debian wheezy-updates main contrib non-free
deb http://ftp.de.debian.org/debian-security wheezy/updates main contrib non-free
Your country code is most likely not "de", you should use the code of your country here. Using your country code in the file will speed up the package download.
Update the packages for Wheezy
The following commands will install all pending Wheezy updates. This ensures that your system is in a good shape for the update to Jessie.
Ready for first upgrade:
Follow this with:
Check the package state to ensure that no packages are on hold or in half installed state
This test is important, we will check the package state to ensure that no packages are on hold or in half installed state. Your system and apt database must be in a good shape before we proceed with the dist upgrade. If there are any broken or "on hold" packages, then fix these issues before the upgrade.
Check that no packages are on hold by querying the package database with the dpkg command:
dpkg --get-selections | grep hold
When both commands did not return any packages, then proceed with the upgrade.
Update the sources.list for Jessie
Edit the /etc/apt/sources.list file again:
and replace its content with the following lines:
deb http://ftp.de.debian.org/debian/ jessie main contrib non-free
deb-src http://ftp.de.debian.org/debian/ jessie main contrib non-free
deb http://httpredir.debian.org/debian jessie-updates main contrib non-free deb-src http://httpredir.debian.org/debian jessie-updates main contrib non-free
deb http://security.debian.org/ jessie/updates main contrib non-free
deb-src http://security.debian.org/ jessie/updates main contrib non-free
Choose your nearest locale by replacing "de" with e.g. "us" or your country code. Then save the file and run the following command to update the sources database:
Jessie Upgrade in two steps
It is recommended to do the upgrade in two steps, first run "apt-get upgrade" to install the base packages and then run "apt-get dist-upgrade" to do the actual distribution upgrade,
Start with the update by running this command:
Next we will do the distribution upgrade by running:
A reboot is required to finish the upgrade and load the new kernel:
Check the update
To check which Debian version is currently installed on the system, take a look at the file /etc/os-release.
The result on an Debian Jessie system is:
- Debian: http://www.debian.org/