CentOS nightly auto updates using yum-cron
It seems like new security vulnerabilities comes out at least once per month now a days. Keeping your systems up to date is the easiest way to keep these threats at bay as well as overall system stability. You can do nightly YUM updates automatically with email notifications via a package called yum-cron. This is a simple and easy solution to keeping servers up to date without using a centralized patching solution (such as Spacewalk).
Step 1 – Install the yum-cron package and setup email notifications:
yum -y install yum-cron
chkconfig yum-cron on
Then edit /etc/sysconfig/yum-cron (CentOS 6) to set MAILTO= email address or /etc/yum/yum-cron.conf (CentOS 7) to set email_to= for email notifications. If you don’t need email notifications you can skip this part.
For CentOS 6:
For CentOS 7:
Step 2 – Start the yum-cron service…
service yum-cron start
Step 3 – Verifying yum-cron is working
Check that the service is running.
service yum-cron status
You can check your cron log at /var/log/cron to see if it ran using the following command.
cat /var/log/cron | grep yum.cron
You can also check the yum.log when it does notify of updates by email.