Configuring automatic updates via yum for RHEL/Centos packages

In order to keep your systems up to date and secure the yum tool is the easiest method of completing this, however without automation your systems can easily miss updates and become insecure. There is however an easy solution to allow you to setup automatic updates of RedHat/Centos packages using a simple bash script and cron job implementation.

How to

Create a new file in the /etc/cron.daily/ location entitled yumupdate. (This will enable the script to be run daily. If you want the script to only run once a week to install updates, you can create the file in cron.weekly instead.)

# vi /etc/cron.daily/yumupdate

Once created, enter the contents below, save the file.

#!/bin/sh /usr/bin/yum -R 10 -e 0 -d 0 -y update yum /usr/bin/yum -R 10 -e 0 -d 0 -y update

Lastly the script file needs to be executable.

#chmod u+x yumupdate


Leave a Reply

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