dnf-automatic provides automated package updates for AlmaLinux/Rocky Linux, similar in purpose to unattended-upgrades on Debian-based systems — this guide covers setup and configuration.
Why Automatic Updates Matter
See How to Enable Automatic Security Updates on Ubuntu & Debian for the general rationale — the same principle applies here: staying current with security patches significantly reduces your exposure window to known vulnerabilities.
Step 1 — Install dnf-automatic
sudo dnf install dnf-automatic -y
Step 2 — Configure Update Behavior
sudo nano /etc/dnf/automatic.conf
[commands]
upgrade_type = security
download_updates = yes
apply_updates = yes
upgrade_type = security applies only security-relevant updates automatically — a conservative, commonly recommended default, since automatically applying every package update (including feature updates) carries higher risk of unexpected breakage.
Step 3 — Configure Email Notifications (Optional)
[emitters]
emit_via = email
[email]
email_from = [email protected]
email_to = [email protected]
email_host = localhost
Requires a working local mail setup (see How to Install and Configure Postfix as a Mail Transfer Agent) to actually deliver notifications.
Step 4 — Enable and Start the Timer
sudo systemctl enable --now dnf-automatic.timer
Step 5 — Verify the Timer Schedule
systemctl list-timers dnf-automatic.timer
By default, runs once daily — adjust the timer schedule if a different frequency is preferred by editing the associated timer unit.
Testing Without Actually Applying Updates (Dry Run)
sudo dnf-automatic --timer=dnf-automatic-notifyonly.timer
Or manually set apply_updates = no temporarily to test notification behavior without actually installing anything, useful for initial configuration verification.
Applying Updates Manually When Needed
sudo dnf-automatic
Runs the configured update process immediately, outside its normal scheduled timing.
Excluding Specific Packages from Automatic Updates
[filters]
exclude=kernel*
Useful if you want to manage kernel updates manually (perhaps to control reboot timing) while still automating other security updates.
Handling Updates That Require a Reboot
dnf-automatic applies updates but doesn't automatically reboot — for updates genuinely requiring a reboot (kernel updates), you'll need a separate mechanism or manual process to actually reboot when appropriate, similar to the consideration in How to Enable Automatic Security Updates on Ubuntu & Debian.
Checking Update History
sudo dnf history
Common Errors
Timer enabled but updates aren't being applied — verify the timer is actually active (systemctl status dnf-automatic.timer) and check journalctl -u dnf-automatic for any errors during recent execution attempts.
Continue Reading
- How to Use dnf: The Package Manager for AlmaLinux & Rocky Linux
- How to Enable Automatic Security Updates on Ubuntu & Debian
- How to Get Started with AlmaLinux/Rocky Linux on a VPS
Browse more articles in AlmaLinux & Rocky Linux.