Mascote

notes to self.

Configuring Automatic Package Upgrade on Debian/Ubuntu

UPDATE: To enable without pain just run: dpkg-reconfigure unattended-upgrades.

In order to enable automatic package upgrades you need to install unattended-upgrades package from repository:

1
2
3
aptitude install unattended-upgrades
#or
apt-get install unattended-upgrades

Then configure what will be upgraded periodicaly editing the file /etc/apt/apt.conf.d/50unattended-upgrades. The file is well commented, so in this case I configured to install security upgrades only and an email address to receive alert in case of problems:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Automatically upgrade packages from these (origin:archive) pairs
Unattended-Upgrade::Allowed-Origins {
    "${distro_id}:${distro_codename}-security"; 
//    "${distro_id}:${distro_codename}-updates";
//    "${distro_id}:${distro_codename}-proposed";
//    "${distro_id}:${distro_codename}-backports";
};

...

// Send email to this address for problems or packages upgrades
// If empty or unset then no email is sent, make sure that you
// have a working mail setup on your system. A package that provides
// 'mailx' must be installed.
Unattended-Upgrade::Mail "myemailaddres@example.com";

Later configure the file /etc/apt/apt.conf.d/10periodic:

1
2
3
4
5
6
7
8
// Enable periodic
APT::Periodic::Enable "1";
// Download packages every n-days.
APT::Periodic::Download-Upgradeable-Packages "1";
// Refresh package list automaticaly every n-days, in this case, everyday.
APT::Periodic::Update-Package-Lists "1";
// Enable Unattended Upgrades to run every n-days, well, you know :)
APT::Periodic::Unattended-Upgrade "1";

That is.