Set up automatic unattended updates for Ubuntu 20.04

Unattended-upgrades is a package that allows Ubuntu to automatically download and install security updates and other important updates without any user intervention. This can be useful for servers or other systems that are running 24/7, as it ensures that the system remains up-to-date with security patches and other important updates.

Ubuntu 20.04 includes an automatic updates feature called “unattended-upgrades” that can be configured to automatically install security updates and other important updates. Here’s how you can set it up:

  1. First, install the “unattended-upgrades” package by running the command “sudo apt install unattended-upgrades”
  2. Next, edit the configuration file located at “/etc/apt/apt.conf.d/50unattended-upgrades” using your favorite text editor.
  3. In the configuration file, you can configure the types of updates that will be installed automatically. By default, only security updates are installed automatically. You can also configure to install other types of updates such as recommended updates, package updates, and package upgrades.
  4. Once you have finished editing the configuration file, you can enable the automatic updates by running the command “sudo dpkg-reconfigure -plow unattended-upgrades”
  5. The unattended-upgrades package runs daily and check for updates, when updates are available it will download and install them automatically.

You can also configure the automatic updates to download and install updates only during a specific time period, by configuring the “Unattended-Upgrade::Automatic-Reboot” and “Unattended-Upgrade::Automatic-Reboot-Time” options in the configuration file.

You can also check the status of unattended upgrades by running the command “sudo unattended-upgrades –dry-run”

It’s important to note that, unattended upgrades might not be suitable for all the environments, it’s recommended to test the configuration in a non-production environment before deploying it to a production environment. Also, make sure that you have a reliable backup and monitoring system in place before enabling automatic updates.

Leave a Comment