Prerequisites
- SSH Access to a CentOS 9 server
- Proper user permissions (typically root access or sudo)
Setting Up Automatic Updates
CentOS 9 utilizes dnf-automatic for automatic updates. First, you need to install the dnf-automatic package:
sudo yum install -y dnf-automaticNext, configure the dnf-automatic settings by editing its configuration file:
sudo vi /etc/dnf/automatic.confIn the configuration file, adjust the settings to fit your needs. You can specify the type of updates you want to apply, the frequency of updates, and whether to reboot the system if necessary. Here’s an example configuration:
[commands]
upgrade_type = security
random_sleep = 300
[emitters]
system_name = None
emit_via = email
email_from = [email protected]
email_to = [email protected]
email_host = localhost
[base]
debuglevel = 1
mdpolicy = group:main
After configuring dnf-automatic, enable and start the service:
systemctl enable --now dnf-automatic.timerThe dnf-automatic.timer service will trigger dnf-automatic to check for and apply updates based on your configuration.
Monitoring and Logging
It’s important to monitor the automatic updates process. Logs for dnf-automatic can be found in /var/log/dnf.log. Regularly check this log to ensure updates are being applied successfully:
cat /var/log/dnf.logConclusion
Setting up automatic updates on CentOS 9 is a proactive step towards maintaining system integrity. With dnf-automatic, you can have peace of mind that your system is receiving the necessary updates without manual oversight.
Additional Resources
For further reading on dnf-automatic and managing updates on CentOS, refer to the official CentOS documentation.