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
Linux 16 Useful Bandwidth Monitoring Tools to Analyze Network Usage in Linux
Viewed 7888 times since Mon, Sep 21, 2020
LVM: Reduce an existing Logical Volume / Filesystem
Viewed 1441 times since Sat, Jun 2, 2018
How To Use Systemctl to Manage Systemd Services and Units
Viewed 5404 times since Mon, Dec 7, 2020
7 Tips – Tuning Command Line History in Bash
Viewed 2879 times since Fri, Jul 5, 2019
Linux Chage Command to Set Password Aging for User
Viewed 1064 times since Tue, Sep 11, 2018
PROCESSOR AND MEMORY INFORMATION
Viewed 4473 times since Sat, Jun 2, 2018
Linux Kernel /etc/sysctl.conf Security Hardening
Viewed 21903 times since Fri, Aug 3, 2018
How to automate SSH login with password? ssh autologin
Viewed 1360 times since Fri, Jun 8, 2018
Tunnel SSH Connections Over SSL Using ‘Stunnel’ On Debian 7 / Ubuntu 13.10
Viewed 1564 times since Fri, Sep 28, 2018
LVM: Extend SWAP size by growing existing Logical Volume
Viewed 1382 times since Sat, Jun 2, 2018