How to Update Rocky Linux 8 with dnf-automatic

Updated on July 20, 2022
How to Update Rocky Linux 8 with dnf-automatic header image

Keeping your server up to date is important, as it ensures that security patches and bug fixes get applied to all the packages on it. You should already know how to manually update your server. By using dnf-automatic to automate this process, you will never have to worry about forgetting to update your server again.


1. Installation

  1. Log in as the non-root user.

  2. Install the dnf-automatic package.

     $ sudo dnf install dnf-automatic

2. Configuration

Open the configuration file.

$ sudo vim /etc/dnf/automatic.conf

By default, dnf-automatic downloads updates without applying them. If you want dnf-automatic to apply updates to your server after it has downloaded them, find the apply_updates parameter, and change it to yes.

apply_updates = yes

You can also choose to only install security updates. To do this, set the upgrade_type parameter to security. If you leave it set to default, dnf-automatic installs all updates, including security updates.

upgrade_type = security

Finally, set the emit_via parameter to motd. This tells you about any updates that have been installed, every time you log in to your server.

emit_via = motd

Save and exit the file when you've finished editing it. Before continuing, run the dnf-automatic command manually to make sure that there are no errors in your configuration file.

$ sudo dnf-automatic

3. Set Timer

The package includes a timer that you can use with systemd to run dnf-automatic on a schedule. Enable the timer with the systemctl command.

$ sudo systemctl enable --now dnf-automatic.timer

Your server will now run dnf-automatic every day at 06:00 a.m.

4. Optional: Configure the Timer

If you want to change the timer to a more convenient schedule, you should edit the timer file.

$ sudo vim /etc/systemd/system/

Change the time specified after the OnCalendar parameter. For example, to change the timer to 01:00 a.m., use this setting:

OnCalendar=*-*-* 01:00

The configuration file also specifies a randomized delay of up to 60 minutes, which means that dnf-automatic runs at a slightly different time every day. You can reduce the maximum randomized delay to shorten the time window during which dnf-automatic may run, or you can set it to 0m to always run exactly at the time specified.

RandomizedDelaySec = 0m

After making changes to the timer file, you need to reload the systemd daemon to apply the changes.

$ sudo systemctl daemon-reload

To check if your new timer configuration worked, list all the timers on the system.

$ systemctl list-timers 

Find the dnf-automatic.timer entry, and verify that the NEXT column shows the correct time that you configured.


In this article, you have set up dnf-automatic to apply updates to your server on a daily timer. You can read more about configuring dnf-automatic in the DNF documentation.