NIXVERSE

How to Configure Automatic Updates with yum-cron on CentOS 7

Jan 18, 2020

Install yum-cron package:

$ sudo yum install yum-cron

Configure yum-cron for checking and applying regular updates daily:

$ sudo sed -i "s/update_cmd =.*/update_cmd = default/g" /etc/yum/yum-cron.conf
$ sudo sed -i "s/update_messages =.*/update_messages = yes/g" /etc/yum/yum-cron.conf
$ sudo sed -i "s/download_updates =.*/download_updates = yes/g" /etc/yum/yum-cron.conf
$ sudo sed -i "s/apply_updates =.*/apply_updates = yes/g" /etc/yum/yum-cron.conf

Configure yum-cron for checking and applying security updates hourly:

$ sudo sed -i "s/update_cmd =.*/update_cmd = security/g" /etc/yum/yum-cron-hourly.conf
$ sudo sed -i "s/update_messages =.*/update_messages = yes/g" /etc/yum/yum-cron-hourly.conf
$ sudo sed -i "s/download_updates =.*/download_updates = yes/g" /etc/yum/yum-cron-hourly.conf
$ sudo sed -i "s/apply_updates =.*/apply_updates = yes/g" /etc/yum/yum-cron-hourly.conf

Start yum-cron service:

$ sudo systemctl start yum-cron

Enable yum-cron to start automatically after reboot:

$ sudo systemctl enable yum-cron

Check if yum-cron is running:

$ sudo systemctl status yum-cron

Check yum-cron manual page for additional information:

$ man yum-cron