Managing update with apt-get and cron-apt on debian-based systems


In this Howto I'd like to show how you can download updates automatically and receive notifications when they're available on your debian-based system.

All the debian repositories, apt-get uses are normally listed in the file: /etc/apt/sources.list

The current list of updates can be downloaded using:

apt-get update

The Update is installed simply by executing:

apt-get upgrade

Now it would be great if the server would download (just download, not install) the updates automatically and send a notifcation to the administrator, so he can take care of it as soon as possible.

This can be done with cron-apt. The installation is quite easy:

apt-get install cron-apt

As said, cron-apt will download the available updates (we'll configure it to download them, not to automatically install them) and send a notification.

Therefore you edit the file /etc/cron-apt/config and remove the comment signs (#) on the beginning of the following lines:

MAILTO="admin@example.net"
MAILON="upgrade"

The e-mail address has to be replaced by the administrator's email address.

For cron-apt to really send an e-mail notification, we still have to copy a cron-apt script into the good place:

cp /usr/share/doc/cron-apt/examples/9-notify /etc/cron-apt/action.d/

The directory action.d contains actions that can be executed by cron-apt.

From now the administrator will receive an e-mail notification, and updates can be installed just by executing:

apt-get upgrade