It is important to keep your Linux server up to date with security updates, Linux Distributions like Ubuntu and Debian release updates daily, so it can become a tedious job to keep the system up to date. Thankfully there is an option to install security updates automatically, here are the steps to enable automatic security updates in Ubuntu 14.04 and later versions.

1) Install the unattended-upgrades package with apt.

sudo apt-get install unattended-upgrades

2) To enable the unattended-upgrades function, run:

sudo dpkg-reconfigure --priority=low unattended-upgrades

This will start an interactive wizard:

Ubuntu unattended updates.

 

Choose "Yes" here and press enter. This will create a new file /etc/apt/apt.conf.d/20auto-upgrades which activates the auto update function.

3) Adjust the update options in the file /etc/apt/apt.conf.d/50unattended-upgrades

nano /etc/apt/apt.conf.d/50unattended-upgrades

The default setup will be this:

Unattended-Upgrade::Allowed-Origins {
 "${distro_id}:${distro_codename}-security";
// "${distro_id}:${distro_codename}-updates";
// "${distro_id}:${distro_codename}-proposed";
// "${distro_id}:${distro_codename}-backports";
};

This means that only security updates will be installed automatically. This is the safest option as security updates should never break the existing server setup. If you like to install normal updates automatically as well, then remove the // in front of the "${distro_id}:${distro_codename}-updates" line.

Tagged on:

Leave a Reply

Your email address will not be published. Required fields are marked *

*