Linux servers software updates

Software updating on the Debian servers is done using the Advanced Packaging Tool (apt), which manages software installed and their dependencies. This page describes the basic use of the apt tools, for more information refer to the man pages ('man apt')

Updating the local packages index

The following command updates the local package index with changes made on the source repositories:
user@server:~$ sudo apt-get update
Failing to update the local index can result in errors since packages may no longer be available or have been replaced with a newer version.

Updating installed packages

Both following commands present the user with a prompt before actually upgrading, indicating which packages will be upgraded and to what version. Please review these carefully, especially for updates to mysql.

Upgrades can also contain changes to configuration files. If configuration files are changed by the upgrade which also have changes made by the user, a prompt will be given, allowing you to inspect the diff and choose a version or resolve any conflicts

The following command updates installed packages to the latest available version. If packages have a new dependency introduced they will not be updated, and packages will not be removed.

user@server:~$ sudo apt-get upgrade

In order to update packages with new or changed dependencies run the following command:

user@server:~$ sudo apt-get dist-upgrade

Distribution upgrades

When a new distribution needs to be switched to, the /etc/apt/sources.list file should be edited, and occurances of the current distribution name can be replaced with the new distribution.

Using this method, it is also possible to switch from stable to testing to unstable. However, this is a one-way process, and is not advised for production servers running 24/7.

After updating the sources, run apt-get update and apt-get dist-upgrade. Distribution upgrades usually involve a lot more updates, which are also more likely to contain configuration changes to installed tools.