
This guide explains how to set up automatic updates for CentOS 9, 10, and 11. Enabling automatic updates helps keep your system secure and up to date without manual intervention.
CentOS 9, 10, 11: Enabling Automatic Updates
The latest CentOS versions use DNF (Dandified YUM) as the default package manager. To automate updates, install the dnf-automatic package.
To install it, run:
dnf install dnf-automatic
To verify the installation, check package details:
rpm -qi dnf-automatic
This will display package information, including the installed version and description.
Configuring DNF Automatic Updates
After installation, navigate to the DNF configuration directory:
cd /etc/dnf/
Edit the automatic.conf file to adjust update settings:
vim automatic.conf
In the [commands]
section, set the update type:
upgrade_type = default
download_updates = yes
- default updates all available packages.
- security updates only security-related packages.
In the [emitters]
section, enable system notifications by changing the emit_via
option to motd, so update notifications appear at login:
system_name = my-centos-server
emit_via = motd
Other options:
- stdio (default) logs output to standard input/output.
- email sends update notifications via email.
To configure email notifications, modify the [email]
section:
email_from = root@server.com
email_to = root
email_host = localhost
Save the file and close the editor.
Enabling and Running Automatic Updates
To activate and start the automatic update timer, run:
systemctl enable –now dnf-automatic.timer
To check if the timer is running:
sudo systemctl list-timers dnf-
The output will display scheduled automatic updates.
Conclusion
By enabling DNF automatic updates, your CentOS 9, 10, or 11 system will stay updated without manual intervention. This ensures faster security patches, bug fixes, and system stability.
Would you like to configure updates for a specific schedule? Let me know!