Set Up Automatic Updates on CentOS 9

1 min read

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:

Bash
sudo yum install -y dnf-automatic

Next, configure the dnf-automatic settings by editing its configuration file:

Bash
sudo vi /etc/dnf/automatic.conf

In 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:

Bash
[commands]
upgrade_type = security
random_sleep = 300

[emitters]
system_name = None
emit_via = email
email_from = root@yourdomain.com
email_to = user@yourdomain.com
email_host = localhost

[base]
debuglevel = 1
mdpolicy = group:main

After configuring dnf-automatic, enable and start the service:

Bash
systemctl enable --now dnf-automatic.timer

The 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:

Bash
cat /var/log/dnf.log

Conclusion

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.

Leave a Reply