Debian 4.0 has been released. It is recommended that you upgrade the system to latest version. Upgrading remote Debian server is a piece of cake :D

Currently many of our boxes are powered by Debian 3.1 Sarga. For example typical web server may have following packages only: => Apache => PHP => Postfix and other mail server software => Iptables and backup scripts => MySQL 5.x etc Procedure

Following are essential steps to upgrade your system: 1. Verify current system 2. Update package list 3. Update distribution 4. Update /etc/apt/sources.list file 5. Reboot system 6. Test everything is working Backup your system

Before upgrading your Debian systems make sure you have backup (I’m assuming that you make backup copies of all important data/files everyday:):

  1. User data / files / Emails (/home, /var/www etc)
  2. Important system files and configuration file stored in /etc
  3. MySQL and other database backup
  4. Backup Installed package list [Get list of installed software for reinstallation / restore software]

Step # 1: Verify current system

File /etc/debian_version stores current Debian version number : $ cat /etc/debian_version Output:


Find out kernel version $ uname -mrs Output:

Linux 2.6.8-3-386 i686

Step #2: Update package list

Use apt-get command: # apt-get update Step #3 : Update distribution

Pass dist-upgrade option to apt-get command. This will upgrade Sarga to Etch. dist-upgrade’ in addition to performing the function of upgrade, also intelligently handles changing dependencies with new versions of packages; apt-get has a “smart” conflict resolution system, and it will attempt to upgrade the most important packages at the expense of less important ones if necessary.

This will ask you about a lot of configuration files that may have change by yourself, be sure to choose first option “D”, to display the contents of both files, the older and the newer, and check if you can replace with the new one or better stay with the old one, anyway, you will find the old ones in your directory named as: xxxx.yyy.dpkg-old (Do not forget anyway first to Backup your Debian

apt-get dist-upgrade

This upgrade procedure takes time. Depend upon installed softwares and other factors such as network-speed you may need to wait from 10 minutes to 1+ hour(s). Step #4 : Update /etc/apt/sources.list file

There seems to be a small bug in upgrade procedure. (Not always happens, did not happen on this particular server) You need to manually update Debian security source line. You will see an error as follows: W: Conflicting distribution: stable/updates Release (expected stable but got sarge) W: You may want to run apt-get update to correct these problems

Just open /etc/apt/sources.list file: # vi /etc/apt/sources.list Find line that read as follows: deb stable/updates main contrib Replace with : deb etch/updates main contrib non-free

Save and close the file. Now type the following command: # apt-get update Step #5: Reboot system

You are done. Just reboot the system: # reboot

Step #6: Make sure everything is working… See Debian distro version: $ cat /etc/debian_version Output: 4.0 Make sure all services are running, just go thought all log files once. # netstat -tulpn # tail -f /var/log/log-file-name # less /var/log/dmesg # top .... ... .... Use apt-key command to manage the list of keys used by apt to authenticate packages. Packages which have been authenticated using these keys will be considered trusted. Make sure you see package etch related keys: # apt-key list /etc/apt/trusted.gpg -------------------- pub 1024D/2D230C5F 2006-01-03 [expired: 2007-02-07] uid Debian Archive Automatic Signing Key (2006) <> pub 1024D/6070D3A1 2006-11-20 [expires: 2009-07-01] uid Debian Archive Automatic Signing Key (4.0/etch) <> pub 1024D/ADB11277 2006-09-17 uid Etch Stable Release Key <> If there is a problem use following command to update the local keyring with the keyring of Debian archive keys and removes from the keyring the archive keys which are no longer valid. # apt-key update # apt-key list Finally just see if any new updates/security updates are available: # apt-get update # apt-get upgrade Read more interesting articles like this at: NixCraft, this was extracted from there.