Keeping my system updated automatically

It is all known that packages are upgraded daily in Ubuntu and Debian world. This is based on how Ubuntu and Debian works, and I personally like it.

The only nuisance is you need to upgrade your system frequently, otherwise you are going to use old package versions, making it difficult to report bugs, and also, being exposed to security vulnerabilities.

There is a solution on how to ask your system to automatically check for new packages, download and install them automatically.

I usually do that on my system. In order to do that, you need to install a package called cron-apt. Cron-apt, by defaul, only downloads packages which means that the actual installation must be done manually.

# apt-get install cron-apt

If you want to be install the packages automatically, you just need to add the upgrade or dist-upgrade line to be executed by the cron-apt. This is how I do this:

# echo dist-upgrade -d -y -o APT::Get::Show-Upgraded=true >> /etc/cron-apt/action.d/3-download

In this example, the system is dist-upgraded every day at 4:00 AM, as showed in the cron-apt cron entry:

$ cat /etc/cron.d/cron-apt

0 4    * * *    root    test -x /usr/sbin/cron-apt && /usr/sbin/cron-apt

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s