By KFSys
System Administrator
In today’s fast-paced digital world, keeping your systems secure and up-to-date is more crucial than ever. Automation plays a key role in ensuring your servers are running smoothly without the need for constant manual intervention. Enter Yum Cron, a tool that can make your server management tasks a whole lot easier. In this article, we’ll dive into what Yum Cron is, why it’s essential, and how you can leverage it to simplify your server maintenance.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted Answer
Yum Cron is a utility for RHEL-based systems (including CentOS, Fedora, and other similar distributions) that automates the task of updating software packages using Yum, the default package manager. Yum Cron runs in the background at regular intervals, checking for and applying available updates to your system. It can be configured to either notify you of available updates or automatically apply them, ensuring that your system remains current and protected against security vulnerabilities.
Keeping software packages updated is a critical aspect of server management. Outdated packages can expose your server to a wide range of security risks and compatibility issues. Regularly applying updates can:
Enhance Security: Unpatched vulnerabilities are a major cause of system compromises. Yum Cron helps ensure your system is always patched against the latest security threats.
Minimize Downtime: Manually updating software can require frequent intervention, leading to potential service interruptions. Yum Cron automates the process, allowing updates to occur without manual oversight, minimizing downtime.
Save Time: System administrators often need to manage multiple servers. Automating routine tasks like updates frees up time for focusing on more complex issues.
Compliance: Many industries require systems to be patched promptly as part of compliance measures. Yum Cron helps you maintain these standards effortlessly.
Now that you understand why Yum Cron is useful, let’s go over how to install and configure it to suit your needs.
To install Yum Cron, you simply need to run the following command in your terminal:
sudo yum install yum-cron
This command will install the necessary package and dependencies.
Once installed, you need to enable and start the Yum Cron service:
sudo systemctl enable yum-cron
sudo systemctl start yum-cron
This ensures that Yum Cron will automatically run whenever your server starts.
The configuration file for Yum Cron is located at /etc/yum/yum-cron.conf
. You can edit it to suit your preferences:
sudo nano /etc/yum/yum-cron.conf
Here are some important settings you can configure:
Update Notification: You can choose whether you want Yum Cron to only notify you of updates or automatically apply them. The relevant settings are found under the email
and update_cmd
options.
Apply Updates Automatically: To automatically apply security updates, set the update_cmd
line to:
update_cmd = security
To apply all updates automatically, set it to:
update_cmd = default
Email Notifications: You can specify an email address for notifications. This helps keep you informed about updates without needing to manually check logs:
email_from = root@localhost
email_to = youremail@example.com
Once configured, you can verify if Yum Cron is working correctly by checking its log file located at /var/log/yum.log
. This file will give you an overview of the updates that were applied.
You can also use the following command to check the status of Yum Cron:
sudo systemctl status yum-cron
This command will show you if Yum Cron is active and whether it’s applying updates as expected.
Backup Regularly: Always ensure that you have recent backups of your system before enabling automatic updates. This will help you recover in case an update causes an issue.
Selective Updates: If you’re managing critical servers, consider configuring Yum Cron to only apply security updates (update_cmd = security
) instead of all updates. This approach minimizes the risk of stability issues.
Test on Staging Servers: For production environments, use Yum Cron to test updates on a staging server before deploying to production. This can help identify any potential issues early.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.