YUM CRON RHEL7: Configure automatic updates.


The yum-cron package provides a convenient way to check for, download and apply updates automatically.

Installation procedure

Install the yum-cron package:

# yum install -y yum-cron

Start the yum-cron service:

# systemctl start yum-cron

By default, the configuration of the yum-cron service is done through two files following exactly the same syntax:

  • /etc/yum/yum-cron.conf defines what is done once every day,
  • /etc/yum/yum-cron-hourly.conf defines what is done once every hour.

Still by default, no action in defined in the /etc/yum/yum-cron-hourly.conf file. Conversely, in the /etc/yum/yum-cron.conf file associated with daily actions, instructions are given to send a message on stdio (which means written into the /var/log/cron file) when any update is available (see update categories below), to download it without applying it.

Configuration syntax

In any of the two configuration files, configuration is defined through the following directives:

  • update_cmd = value specifies the category of upgrade where value can take:
    • default for yum upgrade,
    • security for yum –security upgrade,
    • security-severity:Critical for yum –sec-severity=Critical upgrade,
    • minimal for yum –bugfix upgrade-minimal,
    • minimal-security for yum –security upgrade-minimal,
    • minimal-security-severity:Critical for yum –sec-severity=Critical upgrade-minimal.
  • update_messages = yes/no defines whether a mail is sent when updates from the previously specified category are available.
  • download_updates = yes/no specifies whether these available updates need to be downloaded.
  • apply_updates = yes/no defines whether these available updates need to be applied.
  • random_sleep = 15 specifies the maximum time in minutes to randomly sleep preserving bandwidth and avoiding download storms.
  • emit_via = stdio/email/none defines what kind of message is used: stdio means written into the /var/log/cron file, email causes a mail to be sent, none doesn’t do anything.
  • email_from = root@localhost, email_to = root, email_host = localhost defines respectively when the message is a mail the originator’s email address, the recipient’s email address and the host to which the mail is sent.

Note: As the official CentOS repositories don’t provide any security metadata, update_cmd = default is the only option that works (see here for details). To get these security metadata, you will have to get them through this website. It is also possible to get CentOS security updates through the procedure provided by Casey Labs.

Source: Linuxaria’s website.

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
YUM CRON Enabling automatic updates in Centos 7 and RHEL 7
Viewed 1694 times since Fri, Oct 26, 2018
Linux Screen
Viewed 1018 times since Sat, Jun 2, 2018
6 rsync Examples to Exclude Multiple Files and Directories using exclude-from
Viewed 1031 times since Wed, Oct 31, 2018
List of 10 Must Know Oracle Database Parameters for Database Administrator
Viewed 14908 times since Thu, Jun 21, 2018
LVM: Extend an existing Logical Volume / Filesystem
Viewed 1145 times since Sat, Jun 2, 2018
LVM: Extend an existing Volume Group by adding a new disk
Viewed 890 times since Sat, Jun 2, 2018
Red Hat Enterprise Linux - Allow Root Login From a Specific IP Address Only
Viewed 804 times since Wed, Oct 3, 2018
Logrotate Example for Custom Logs
Viewed 1306 times since Sun, Jan 12, 2020
ZPOOL: Add a mirror to a concat zpool
Viewed 1334 times since Sun, Jun 3, 2018
Epoch & Unix Timestamp Conversion Tools
Viewed 21343 times since Fri, Jun 22, 2018