RHEL7: Configure automatic updates.

Presentation

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@localhostemail_to = rootemail_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 updatesthrough the procedure provided by Casey Labs.

Source: Linuxaria’s website.

Additional Resources

Rackspace wrote a similar tool called Auter available through EPEL:

You can also read a Centmin Mod article about Setting up automatic updates.

 

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
Learn how to align an SSD on Linux
Viewed 12578 times since Fri, May 15, 2020
Df command in Linux not updating actual diskspace, wrong data
Viewed 2974 times since Wed, May 30, 2018
Enabling or disabling a repository using Red Hat Subscription Management
Viewed 9959 times since Mon, Oct 29, 2018
Fałszujemy rozpoznania skanerów #2
Viewed 3047 times since Mon, May 21, 2018
Using IOzone for Linux disk performance analysis
Viewed 8031 times since Wed, Jul 25, 2018
How To Set Up an SSL Tunnel Using Stunnel on Ubuntu
Viewed 3383 times since Fri, Sep 28, 2018
Fałszujemy rozpoznania skanerów #1
Viewed 3094 times since Mon, May 21, 2018
How to encrypt a partition with DM-Crypt LUKS on Linux
Viewed 8294 times since Fri, Jul 13, 2018
How to remove CTRL-M (^M) characters from a file in Linux
Viewed 2692 times since Thu, Feb 7, 2019
Easily Monitor CPU Utilization in Linux Terminal With Stress Terminal UI
Viewed 4183 times since Thu, Apr 18, 2019