If you’re looking for a quick way to keep your CentOS machine patched at all times, become friends with yum-cron.
To install, in terminal, use:
#yum -y install yum-cron
The -y forces the install, answering any Yes / No “are you sure” questions.
Once installed, be sure to start the service using:
# systemctl start yum-cron.service
You can verify the status (make sure it’s running) using:
# systemctl status yum-cron.service
Output should look something like:
yum-cron.service – Run automatic yum updates as a cron job
Loaded: loaded (/usr/lib/systemd/system/yum-cron.service; enabled; vendor preset: disabled)
Active: active (exited) since Mon 2016-11-07 19:16:01 UTC; 2s ago
Process: 5385 ExecStart=/bin/touch /var/lock/subsys/yum-cron (code=exited, status=0/SUCCESS)
Main PID: 5385 (code=exited, status=0/SUCCESS)
Last step is to make sure it’s enabled, this will make sure it restarts in the event the machines reboots later.
# systemctl enable yum-cron.service