How to Configure Automatic Unattended Updates on Ubuntu 20.04 ?

Regular updates of a Linux OS is very important as it helps to secure the system against any security vulnerability. 

As part of our Linux Support Services, we have helped clients to set up automatic updates in their Linux Server.

In this context we will look into how to set up automatic unattended updates on Ubuntu 20.04.


More about the unattended-upgrades package

The unattended-upgrades package in Ubuntu is installed by default in a fresh ubuntu system. This helps to install software updates automatically with its main goal to enhance security.


How to install unattended-upgrades package in Ubuntu 20.04 ?

Installing unattended-upgrades package in Linux is a very easy process. To begin, Log into your Ubuntu server as the root user and run the following command to update and upgrade the system;

$ sudo apt update && sudo apt upgrade

Next install the unattended-upgrades package if it is not available in the system with the following command;

$ sudo apt install unattended-upgrades apt-listchanges bsd-mailx

Then activate the unattended security updates via the command below;

$ sudo dpkg-reconfigure -plow unattended-upgrades

As soon as you run the above command, you will be asked to select yes or no to Automatically download and install stable updates. In this case, simple select yes to proceed with this process.

The next step is to edit the unattended-upgrades file located at /etc/apt/apt.conf.d/50unattended-upgrades. You should use the command below to edit this file;

$ sudo vi /etc/apt/apt.conf.d/50unattended-upgrades

In here you will see the email area where you can input the email address where you will be notified once an update has been made automatically. The line will look like this;

Unattended-Upgrade::Mail "email@email.com";

Other options to set is the Automatic reboot option as well as the email address section.

For the automatic reboot for kernel updates, set the option to true as stated below;

Unattended-Upgrade::Automatic-Reboot "true";

Now you can set the email address option depending on the email address you want to use as;

email_address=email@email.com 

Finally, save this file and exit.

To confirm that the settings is working correctly, us the command below;

$ sudo unattended-upgrades --dry-run


Do you have any Linux Server related issues? We will fix it for you now.

This article covers how to enable automatic updates on Ubuntu 20.04. In fact, Regularly updating your server is a crucial aspect to the overall security of your system.

Sysadmins must be concerned about the security of Linux servers. Installing security updates on time fixes vulnerabilities that could be exploited by malicious individuals to gain access to the system.


How to Enable automatic updates ?

Edit the 20auto-upgrades configuration file as follows:

$ sudo vim /etc/apt/apt.conf.d/20auto-upgrades

This file has only two lines.

The first line is responsible for updating the package lists, while the second initiates the automated upgrades. The auto-update and auto-upgrade are enabled by the value "1." Set this value to "0" if you wish to disable it.


Manually updating your Linux system is a task that's easy to overlook, especially when you’re always dealing with other issues that arise. Configuring automatic updates provides an easy way to get the security patches and feature updates regularly.

Related Posts