CentOS / RHEL : Configure yum automatic updates with yum-cron service

yum-cron is an optional package starting from Red Hat Enterprise Linux 6, this is a plugin for yum. From man page of yum-cron :

yum-cron is a simple way to call yum commands from cron. It provides configuration to keep repository metadata up to date, and to check for, download, and apply updates.

The yum-cron package provides a convenient way to check for, download and apply updates automatically. The cron jobs from the yum-cron package are active immediately after installing the package and there’s no extra configuration necessary. The job will be run when your normal daily cron jobs are set to run.


To install yum-cron package

# yum -y install yum-cron
# chkconfig yum-cron on

Configuration for RHEL 6

Then edit /etc/sysconfig/yum-cron to set MAILTO=[email address] for email notifications.


To exclude packages using yum-cron edit the /etc/sysconfig/yum-cron to have the packeges to be excluded in the automatic uodate :

YUM_PARAMETER=kernel* mysql*

To start yum-cron service after editing configuration file.

# service yum-cron start

Configuration for RHEL 7

Then edit /etc/yum/yum-cron.conf to set email_to=[email address] for email notifications.


To exclude packages using yum-cron edit the /etc/yum/yum-cron.conf to have the packeges to be excluded in the automatic uodate :

exclude=kernel* mysql*

In RHEL 7 you can use following options in yum-cron configuration file, to install security updates.

#  What kind of update to use:
# default                            = yum upgrade
# security                           = yum --security upgrade
# security-severity:Critical         = yum --sec-severity=Critical upgrade
# minimal                            = yum --bugfix upgrade-minimal
# minimal-security                   = yum --security upgrade-minimal
# minimal-security-severity:Critical =  --sec-severity=Critical upgrade-minimal
update_cmd = default

To start yum-cron service after editing configuration file.

# systemctl start yum-cron
0 (0)
Article Rating (No Votes)
Rate this article
There are no attachments for this article.
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
20 Linux Command Tips and Tricks That Will Save You A Lot of Time linux
Viewed 2122 times since Thu, Apr 18, 2019
Stunnel Setup
Viewed 11535 times since Fri, Sep 28, 2018
ZFS: Remove an existing zfs filesystem
Viewed 831 times since Sun, Jun 3, 2018
Red Hat Cluster Tutorial
Viewed 990 times since Sun, Jun 3, 2018
Linux - How to get CPU information
Viewed 760 times since Fri, Jun 8, 2018
Use Fail2ban to Secure Your Server
Viewed 2154 times since Fri, Jul 5, 2019
Linux Screen
Viewed 1018 times since Sat, Jun 2, 2018
How to Migrate from RHEL 8 to CentOS 8
Viewed 789 times since Fri, May 15, 2020
RHEL: Reinstalling Boot Loader on the Master Boot Record (MBR)
Viewed 1438 times since Sun, May 27, 2018
Linux: Disks diagnostic using smartctl
Viewed 1622 times since Wed, Jul 25, 2018