How To Apply Updates Automatically With dnf-automatic In RHEL 8/9, AlmaLinux And RockyLinux

  • February 26, 2024
  • 0 Comments

OVERVIEW

Applying updates regularly should be the top priority in the day-to-day tasks of a System administrator. Running unpatched systems for a long time is quite risky.
There are many ways to patch your Linux systems.
Today, we will learn how to apply updates automatically with dnf-automatic in RHEL 8/9 and its clones like AlmaLinux and RockyLinux.

What is dnf-automatic?

The dnf-automatic is an alternative to dnf upgrade command which can be executed automatically and regularly via systemd timers, cron jobs and similar.

It synchronizes the package metadata as needed and then checks for updates available for your RHEL-based systems.
Depending upon the configuration file settings, dnf-automatic command either downloads the package updates, or downloads and installs the packages, or simply exits.

The function of dnf-automatic is usually controlled by the configuration file (dnf-automatic.timer)
or function-specific timer units as listed below.

  • dnf-automatic-notifyonly - Only notifies when the updates available,
  • dnf-automatic-download - Only downloads the updates, but not install them,
  • dnf-automatic-install - Downloads and install package updates automatically.

You can choose any one that suits your requirements.

Please note that the function-specific timer units will override the settings of the default configuration file i.e. dnf-automatic.timer.


REQUIREMENTS

Before you start, you will need:

  • SSH credentials or File Manager access Logged In as Root
  • Text Editor


READ ME FIRST

This article is provided as a courtesy.

Installing, configuring, and troubleshooting third-party applications is outside the scope of Basic support provided by Starburst Services.


INSTRUCTIONS


STEP 1

Install dnf-automatic

dnf-automatic is available in the default repositories of RHEL and its clones.
To install dnf-automatic in RHEL, Fedora, CentOS Stream, AlmaLinux and Rocky Linux, run:

dnf install dnf-automatic


STEP 2

Edit dnf-automatic default configuration file using Nano editor:

nano /etc/dnf/automatic.conf

The three important settings that you should adjust here are given below:

upgrade_type = security
download_updates = yes
apply_updates = yes


STEP 3

After adjusting the settings, enable the timer unit:

systemctl enable --now dnf-automatic.timer


RESOURCES



KB Article Created: 2024-02-26

How helpful was this article to you?

Posting has been disabled.