Chapter 7. Automating software updates in RHEL 8
DNF Automatic is an alternative command-line interface to YUM that is suited for automatic and regular execution by using systemd timers, cron jobs, and other such tools.
DNF Automatic synchronizes package metadata as needed, checks for available updates, and then performs one of the following actions depending on how you configure the tool:
- Exit
- Download updated packages
- Download and apply the updates
The outcome of the operation is then reported by a selected mechanism, such as the standard output or email.
7.1. Installing DNF Automatic Copiar enlaceEnlace copiado en el portapapeles!
To check and download package updates automatically and regularly, you can use the DNF Automatic tool that is provided by the dnf-automatic package.
Procedure
Install the
dnf-automaticpackage:yum install dnf-automatic
# yum install dnf-automaticCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Verify the successful installation by confirming the presence of the
dnf-automaticpackage:rpm -qi dnf-automatic
# rpm -qi dnf-automaticCopy to Clipboard Copied! Toggle word wrap Toggle overflow
7.2. DNF Automatic configuration file Copiar enlaceEnlace copiado en el portapapeles!
By default, DNF Automatic uses /etc/dnf/automatic.conf as its configuration file to define its behavior.
The configuration file is separated into the following topical sections:
[commands]Sets the mode of operation of DNF Automatic.
WarningSettings of the operation mode from the
[commands]section are overridden by settings used by a systemd timer unit for all timer units exceptdnf-automatic.timer.[emitters]Defines how the results of DNF Automatic are reported.
[command]sectionProvides the command emitter configuration.
[command_email]Provides the email emitter configuration for an external command used to send email.
[email]Provides the email emitter configuration.
[base]Overrides settings from the main configuration file of YUM.
With the default settings of the /etc/dnf/automatic.conf file, DNF Automatic checks for available updates, downloads them, and reports the results as standard output.
7.3. Enabling DNF Automatic Copiar enlaceEnlace copiado en el portapapeles!
To run DNF Automatic once, you must start a systemd timer unit. However, if you want to run DNF Automatic periodically, you must enable the timer unit. You can use one of the timer units provided in the dnf-automatic package, or you can create a drop-in file for the timer unit to adjust the execution time.
Prerequisites
-
You specified the behavior of DNF Automatic by modifying the
/etc/dnf/automatic.confconfiguration file.
Procedure
Enable and execute a systemd timer unit immediately:
systemctl enable --now <timer_name>
# systemctl enable --now <timer_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow If you want to only enable the timer without executing it immediately, omit the
--nowoption.You can use the following timers:
-
dnf-automatic-download.timer: Downloads available updates. -
dnf-automatic-install.timer: Downloads and installs available updates. -
dnf-automatic-notifyonly.timer: Reports available updates. -
dnf-automatic.timer: Downloads, downloads and installs, or reports available updates.
-
Verification
Verify that the timer is enabled:
systemctl status <timer_name>
# systemctl status <timer_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: Check when each of the timers on your system ran the last time:
systemctl list-timers --all
# systemctl list-timers --allCopy to Clipboard Copied! Toggle word wrap Toggle overflow
7.4. Overview of the systemd timer units included in the dnf-automatic package Copiar enlaceEnlace copiado en el portapapeles!
The systemd timer units take precedence and override the settings in the /etc/dnf/automatic.conf configuration file concerning downloading and applying updates.
For example, if you set the download_updates = yes option in the /etc/dnf/automatic.conf configuration file, but you have activated the dnf-automatic-notifyonly.timer unit, the packages will not be downloaded.
| Timer unit | Function | Overrides the apply_updates and download_updates settings in the [commands] section of the /etc/dnf/automatic.conf file? |
|---|---|---|
|
| Downloads packages to cache and makes them available for updating.
This timer unit does not install the updated packages. To perform the installation, you must run the | Yes |
|
| Downloads and installs updated packages. | Yes |
|
| Downloads only repository data to keep repository cache up-to-date and notifies you about available updates. This timer unit does not download or install the updated packages | Yes |
|
|
The behavior of this timer when downloading and applying updates is specified by the settings in the This timer downloads packages, but does not install them. | No |