Linux

How To Configure Automatic Updates On CentOS 7

How To Configure Automatic Updates On CentOS 7
Written by itsubuntu

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.

[base]
debuglevel = -2
mdpolicy = group:main
exclude = firefox*

Finally, we are dong with the method to configure automatic updates in CentOS 7 operating system. Let us know if you have any confusion in this tutorial.

About the author

itsubuntu

1 Comment

Leave a Comment