Automatically update EL8

Posted under linux On By xpk

In EL7, we can use yum-cron to automatically install updates. On EL8, the equivalent tool is dnf-automatic. Here is how to set it up.

Install the package

dnf -y install dnf-automatic

Edit the config

Edit /etc/dnf/automatic.conf. It is quite similar to yum-cron config. Some of the important parameters are:

upgrade_type = default # default: all updates; security: security updates only
apply_updates = yes # no: do not apply the updates

If you want to receive email notification, edit the section under [emitters]

Finally, enable the systemd timer

systemctl enable --now dnf-automatic.timer

By default, this timer runs the job daily at 0600, plus a random delay. To see when the next run is scheduled at, run this

[[email protected] ~]# systemctl list-timers dnf-automatic.timer
Tue 2021-07-13 06:23:05 HKT 13h left n/a n/a dnf-automatic.timer dnf-automatic.service

Occasionally, look for processes that require restarting after update.

dnf needs-restarting

If you configure email emitter, you will receive an email whenever an update is downloaded.

The following updates were downloaded on 'rock.one27.lab':
 Package                Architecture   Version             Repository      Size
 rocky-gpg-keys         noarch         8.4-30.el8          baseos          11 k
 rocky-release          noarch         8.4-30.el8          baseos          20 k
 rocky-repos            noarch         8.4-30.el8          baseos          13 k

Transaction Summary
Upgrade  3 Packages

 176 total views,  2 views today

Leave a comment

Your email address will not be published. Required fields are marked *