Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save aont/acd1324d9285b588157b04fd1c155af3 to your computer and use it in GitHub Desktop.

Select an option

Save aont/acd1324d9285b588157b04fd1c155af3 to your computer and use it in GitHub Desktop.

Keeping Rocky Linux 9 Up to Date with dnf-automatic

Keeping your system updated is one of the most important steps to ensure security, stability, and performance. On Rocky Linux 9.6, you can automate updates using the dnf-automatic package, which integrates seamlessly with the dnf package manager. This guide walks you through installation, configuration, and enabling automated updates.


1. Install dnf-automatic

The dnf-automatic tool is not installed by default. To add it, run:

sudo dnf install -y dnf-automatic

2. Configure dnf-automatic

The main configuration file is located at:

/etc/dnf/automatic.conf

Open it with your preferred text editor:

sudo nano /etc/dnf/automatic.conf

Key Options

  • Upgrade type Defines what kind of updates should be applied.

    [commands]
    upgrade_type = security

    Options include:

    • default – all updates
    • security – only security updates
  • Apply updates automatically To enable automatic installation:

    apply_updates = yes
  • Email notifications (optional) You can configure dnf-automatic to send update notifications by editing the [emitters] and [email] sections in the same file.


3. Enable and Start the Timer

dnf-automatic uses systemd timers to schedule update checks.

Enable and start the automatic update timer:

sudo systemctl enable --now dnf-automatic.timer

This ensures updates are checked and applied regularly.


4. Optional Timers

There are different timers depending on your needs:

  • Apply updates automatically:

    sudo systemctl enable --now dnf-automatic-install.timer
  • Notification only (no auto-install):

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

5. Verification

Check the status of the timer:

systemctl status dnf-automatic.timer

Logs can be viewed with:

journalctl -u dnf-automatic

Conclusion

By configuring dnf-automatic, you ensure that your Rocky Linux 9.6 system remains up to date without manual intervention. For critical environments, you may prefer to restrict updates to security patches only; for desktops or development systems, enabling all updates might be more convenient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment