Maker. Baker. Coffee Drinker.

How to set up automatic / unattended updates on Ubuntu Server 18.04 LTS

Advertisements

Install the unattended-upgrades package:

sudo apt install unattended-upgrades

Edit the configuration file (here with nano – replace with any other text editor):

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

The most important: uncomment the “updates” line by deleting the two slashes at the beginning of it:

"${distro_id}:${distro_codename}-updates";

Remove unused kernel packages and dependencies

Unattended-Upgrade::Remove-Unused-Kernel-Packages "true";
Unattended-Upgrade::Remove-Unused-Dependencies "true";

Enable automatic updates and set up update intervals by running:

sudo nano /etc/apt/apt.conf.d/20auto-upgrades
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::AutocleanInterval "7";
APT::Periodic::Unattended-Upgrade "1";

You can see if the auto-upgrades work by launching a dry run:

sudo unattended-upgrades --dry-run --debug

Another way to check if automatic updates work is by waiting a few days and checking the unattended-upgrades logs:

cat /var/log/unattended-upgrades/unattended-upgrades.log
Advertisements

Advertisements