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.

Installation

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.

MAILTO=sys@example.com

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.

email_to=sys@example.com

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.

[commands]
#  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
Attachments
There are no attachments for this article.
Comments
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
python learning
Viewed 1592 times since Wed, Dec 18, 2019
Linux Proxy Server Settings – Set Proxy For Command Line
Viewed 2660 times since Mon, Feb 18, 2019
RHCS: Configure an active/backup pacemaker cluster
Viewed 8644 times since Sun, Jun 3, 2018
Use inotify-tools on CentOS 7 or RHEL 7 to watch files and directories for events
Viewed 13540 times since Fri, Jul 27, 2018
debian How to Upgrade Debian 8 Jessie to Debian 9 Stretch
Viewed 2066 times since Sun, Sep 23, 2018
logrotate - rotates, compresses, and mails system logs.
Viewed 1502 times since Fri, Nov 30, 2018
Linux PAM configuration that allows or deny login via the sshd server
Viewed 1595 times since Wed, Oct 3, 2018
Install Security Patches or Updates Automatically on CentOS and RHEL
Viewed 1509 times since Fri, Oct 26, 2018
INSTALACJA MIB SNMP W SYSTEMIE CENTOS/RHEL 6
Viewed 12635 times since Fri, Nov 30, 2018
Index » Community Contributions » System encryption using LUKS and GPG encrypted keys for arch linux
Viewed 2579 times since Fri, Jul 13, 2018