How to Configure Automatic Unattended Updates on Ubuntu 20.04 ?

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;


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.

Who We Are ?

Most prominent, efficient, and well-performing IT companies and software solutions.

Related Posts