Upgrading Debian OS

Expertise level: Medium 

This tutorial explains how to upgrade your system from Debian Squeeze to Debian Wheezy.
As with all upgrades, begin with a backup of your critical data, which will be the user data in /home/your-users. You should also back up the content of all configurations files which can quickly be archived:
tar -czvf host.etc.tar.gz /etc
Move your files for safe storage on a backup drive.

Before proceeding on your own, we highly recommend you test the upgrade on a second non-critical server prior to performing the upgrade.

You should install all available updates for Debian 6 before upgrading to Debian 7 (wheezy). Here's how:

  1. Update your package lists by entering the following command:

    sudo apt-get update
  2. Install the updates by entering the following command:

    sudo apt-get upgrade

Any available updates for Debian 6 will be installed.

Stopping Services

We recommend that you stop as many services as possible before upgrading to Debian 7. This includes web server daemons (Apache and nginx), database servers (PostgreSQL and MySQL), and any other non-critical services. To stop a service, enter the following command, replacing apache2 with the name of the service you want to stop:

sudo service apache2 stop

Starting a Screen Session

We recommend that you start a screen session to ensure updates will continue to install in the unlikely event you are disconnected during the upgrade process. Here's how to install screen and start a screen session:

  1. Install screen by entering the following command:

    sudo apt-get install screen
  2. After installation has completed, start a screen session by entering the following command:

  3. If you are disconnected from your server, you can reconnect to the screen session by entering the following command:

    screen -Dr

You are now ready to install Debian 7.

Upgrading to Debian 7


  1. Edit your /etc/apt/sources.list  file and change all instances of squeeze to wheezy. Once you have finished, your /etc/apt/sources.list should resemble the following:

File excerpt:/etc/apt/sources.list

deb http://ftp.us.debian.org/debian/ wheezy main
deb-src http://ftp.us.debian.org/debian/ wheezy main

deb http://security.debian.org/ wheezy/updates main
deb-src http://security.debian.org/ wheezy/updates main

# wheezy-updates, previously known as 'volatile'
deb http://ftp.us.debian.org/debian/ wheezy-updates main
deb-src http://ftp.us.debian.org/debian/ wheezy-updates main
  1.  Update your package lists with the following command:

    sudo apt-get update
  2. Enter the following command to grab the latest versions of key system utilities:

    sudo apt-get install apt dpkg aptitude
  3. After the package updates have completed, upgrade your system by entering the following command. The upgrade will download and install numerous packages. This step may take a while to complete.

    sudo apt-get dist-upgrade

NOTE: Services using Network Security Services (NSS) and Pluggable Authentication Modules (PAM) will need to be restarted. In most cases the default list of services to be restarted is fine. If you have additional services that use NSS or PAM, add them to the list.

Once the system is updated, reboot your system to make sure that there were no problems during the upgrade. 


Troubleshooting Problems

Errors about packages that are removed and not purged may be resolved by installing the latest version of the software or purging the old package. For example, if you receive an error about MySQL, you could try to resolve the issue by entering the following command:

apt-get install mysql-server

If the above step does not work for the package you are trying to install, you may purge the package with the following command after ensuring that you have a backup of the program's data and configuration:

apt-get remove --purge mysql-server


Article is closed for comments.
Powered by Zendesk