Ubuntu 8.04 (Hardy): How to automatically apt-get / aptitude upgrade packages for bugs/security

aptaptitudedebianUbuntu

I have a lab full of workstations running Ubuntu 8.04 (Hardy Heron). My predecessors made a hackish bit of cron script to update, upgrade, and clean daily. I like the fact that it requires zero attention, but want to stick as close to distro-supported methods as possible, so future admins can find and understand it easily. Specifically, it seems that there is infrastructure in Ubuntu to do this more cleanly, so I'd rather use that instead. What does this entail?

This question was inspired by this one, which has a decent but scattered answer. What's the bottom line, based on the documentation?

Best Answer

This answer is based on reading the following files:

/etc/cron.daily/apt
/etc/apt/apt.conf.d/10periodic
/etc/apt/apt.conf.d/50unattended-upgrades
/usr/share/doc/unattended-upgrades/README

which are part of packages (including unattended-upgrades and update-notifier-common) included in the standard Ubuntu installation. There are other tools available from the distribution that could achieve the same ends, such as apticron and cron-apt.


In the file /etc/apt/apt.conf.d/10periodic, add a line

APT::Periodic::Unattended-Upgrade "1";

This configures Apt's periodic scripts to run an unattended upgrade every day. For a longer interval, increase the 1 to a larger number. A 0 for this variable would mean 'disabled'.

In tandem with this, the autoclean line should be enabled by replacing a 0 there:

APT::Periodic::AutocleanInterval "1";

By default, Ubuntu 8.04 only configures automatic unattended upgrades from the hardy-security archive. This will cover you against security vulnerabilities, but not for general bug-fix releases. For that, you need to enable the hardy-updates archive in /etc/apt/apt.conf.d/50unattended-upgrades:

// Uncomment the line that reads as follows:
        "Ubuntu hardy-updates";

Ubuntu's spec for this feature appears on a wiki page. Note that Debian systems seem to have the same exact infrastructure, apparently from this feature migrating upstream.