Configure Automatic Updates : Ubuntu Server

By | 2013/11/29

Configure Automatic Updates : Ubuntu Server

Ubuntu Server allows you to activate automatic updates during the initial installation process. This setting configures your system to automatically download and install security updates. This system is configurable and this tutorial will outline how to enable it if you hadn’t previously, disable it if you no longer want to use it, and select the repositories from which you want to receive updates.

To enable automatic updates on your system you need to ensure you have the unattended-upgrades package installed. This can be done using the following command:

sudo apt-get install unattended-upgrades

This will install a config file that you can tweak found at /etc/apt/apt.conf.d/50unattended-upgrades. This file allows you to configure the repositories you want to receive updates from, packages you want to blacklist from automatic updating, and even an email address where you’d like to be notified of updates.

Configure Automatic Updates

Using your favorite editor, open /etc/apt/apt.conf.d/50unattended-upgrades and update the first section Allowed-Origins as seen in the example below:

// Automatically upgrade packages from these (origin:archive) paris
Unattended-Upgrade::Allowed-Origins {
"${distro_id}:${distro_codename}-security";
//  "${distro_id}:${distro_codename}-updates";
//  "${distro_id}:${distro_codename}-proposed";
//  "${distro_id}:${distro_codename}-backports";
};

If you’d like to receive updates from the updates, proposed or backports repositories, simply uncomment those lines and save.

The Package-Blocklist section is just below. If you have any packages that you do NOT want automatically updated, list them here.

// List of packages to not update
Unattended-Upgrade::Package-Blacklist {
//    "vim";
//    "libc6";
//    "libc6-dev";
//    "libc6-i686";
};

There are quite a few more options in this file. They are well documented, so I’ll leave it to you to determine if the options are right for you.

Enable / Disable Automatic Updates

To enable (or disable) the automatic updates you’ll finally need to edit the /etc/apt/apt.conf.d/10periodic file and make it look like the example here:

APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::AutocleanInterval "7";
APT::Periodic::Unattended-Upgrade "1";

Finally, to disable automatic updates change the “1”s in the file above to “0”.

One thought on “Configure Automatic Updates : Ubuntu Server

  1. André

    files in “/etc/apt/apt.conf.d/”, the first two numbers is priory, right?

    Reply

Leave a Reply