Menu
blog.headdesk.me
blog.headdesk.me

Automatically update EL8

Posted on 2021/07/122021/07/25

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

[root@rock ~]# systemctl list-timers dnf-automatic.timer
NEXT LEFT LAST PASSED UNIT ACTIVATES
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
================================================================================
Upgrading:
 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

Loading

2 thoughts on “Automatically update EL8”

  1. Dan says:
    2024/02/22 at 01:25

    In RHEL 7.9 I was able to modify /usr/sbin/yum-cron to append the output of needs-restarting to the email that is sent at the end of the job. This way I could find a safe time to reboot my servers during off hours. Is there a way to do this with dnf-automatic?

    Reply
    1. xpk says:
      2024/02/22 at 08:03

      You may be able to do so by editing the CommandEmailEmitter class in /usr/lib/python3.9/site-packages/dnf/automatic/emitter.py. Append output from dnf needs-restarting to the email message body.

Leave a Reply Cancel reply

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

Full text search

Recent Posts

  • Generate secure password
  • AWS Compute Savings Plans
  • AWS Zonal Shift
  • Coffee break…
  • Prevent private key from being committed to git
  • aws (14)
  • coffee (2)
  • headfi (1)
  • linux (9)
  • others (61)
  • security (2)
  • tech (41)
  • terraform (3)
  • wordpress (2)

Loading

apache aws awscli azure backup boot cloud coffee docker ec2 EL8 ElasticBeanstalk espresso featured git kernel lelit linux lvm meltdown MFA nat gateway php power proliant python rdp Redhat RHEL rpm Ryzen scp security smartarray smart switch snapshot spectre tech terraform ubuntu ubuntu upgrade vpn windows wordpress workspace

©2026 blog.headdesk.me | Powered by SuperbThemes