Keeping your system up-to-date (Simple)
While some people would rather develop, test, and deploy only on one set of software releases and would rather not change that in years, others would like to stay on the bleeding edge of software.
Getting ready
There are two reasons why updating is important on Debian, for a production server:
Patching security problems, which are usually well-known and may have exploits in the wild through package updates released by the security team and distributed through a special repository
Making sure there is binary compatibility between all the packages in your system (or explicitly break it)
For example, if you were running squeeze (the previous stable version, also known as oldstable antecessor to wheezy) with applications that did not play well with PHP 5.3, you would rather explicitly break your system by having an older PHP (an older Apache, and an older MySQL for PHP library, and so on).
On the other hand, if you were running wheezy (stable) with Nginx, you would like to have the recent security updates for the web server.
It's important to remember that in some cases, upgrading your system (and especially the libraries) might involve API changes that you should be aware of. In 2012, the author released code for a Perl-based Twitter client that used the Twitter API and the POSIX and MongoDB Perl modules; the author had to change the code in 2013 because a function on POSIX was dropped and the MongoDB syntax for connecting to databases and collections changed.
How to do it…
While running stable, Debian will not usually push an update that breaks compatibility. But security updates will go through and when enough security updates are issued, those updates are moved into the main repository. Here's a good recipe for staying on top of it:
Install cron-apt with the command
sudo apt-get install cron-apt
.By default, cron-apt is scheduled to run on a maintenance window of 4 A.M. local time; edit this with the sudo editor
/etc/cron.d/cron-apt
and change if necessary.Make sure services are running after the upgrade (for example, by using a browser or database client, or following your internal test procedures).
If you ever need to do a manual upgrade:
sudo apt-get update
will connect to the Internet and download lists with new versions of softwaresudo apt-get dist-upgrade
will upgrade the system
There's more…
A word of caution. If you're using the codename stable
on your /etc/apt/sources.list
file, the dist-upgrade
command will make major changes when a new release comes out. You might want to stick with the codename wheezy
for consistency or be on top of announcements to be prepared.
In general, upgrades within the same release are fairly safe even for a production environment. And as mentioned earlier, you might choose to not use cron-apt at all. In such cases, you might want to change the default action of cron-apt.
Bear in mind that kernel upgrades don't require an immediate restart. You might as well keep operating with the old kernel until a proper maintenance window is defined. However, very old kernels can break future upgrades of some system libraries.