How To Configure Automatic Updates On CentOS 7

How To Configure Automatic Updates On CentOS 7

Insight: How to configure automatic updates on CentOS 7 with yum-cron script.

In this CentOS tutorial post, we are going to show you the method to configure automatic updates on CentOS 7. This tutorial is also applicable for the CentOS 6 operating system.

How To Configure Automatic Updates On CentOS 7

We will be using yum-cron script to configure automatic updates on CentOS 7. Let’s install and configure yum-cron package at first. This package is already installed on your CentOS system. If not installed you can install the package by running the following command:

sudo yum install yum-cron

Enable and start the service:

sudo systemctl enable yum-cronsudo systemctl start yum-cron

To verify that the service is running:

systemctl status yum-cron

Configuring yum-cron

There are two configuration files, the hourly configuration file yum-cron.conf and the daily configuration file yum-cron-hourly.conf.

To edit the yum-cron configuration file, open the file in your text editor:

sudo nano /etc/yum/yum-cron-hourly.conf

We changed the update_cmd to security and enabled unattended updates by setting apply_updates to yes:

[commands]
update_cmd = security
update_messages = yes
download_updates = yes
apply_updates = yes
random_sleep = 360

The second sections defines how to send messages.

In the [base] section you can override the settings defined in the yum.conf file. For example, you can exclude specific packages from being updated.

Comments

No comments yet. Why don’t you start the discussion?

    Leave a Reply

    Your email address will not be published. Required fields are marked *