This tutorial describes how to configure automatic system updates via YUM on CentOS 7. Given today’s cybersecurity climate, security hygiene has never been more important. Keeping your system up-to-date will help keep your server patched and prevent attacks.
AUTOMATIC INSTALLATION (Single command):
yum -y install yum-cron ; echo 'exclude=kernel*' >> /etc/yum.conf ; sed -i s/"apply_updates = no"/"apply_updates = yes"/g /etc/yum/yum-cron.conf ; systemctl start yum-cron.service ; service enable yum-cron
MANUAL INSTALLATION:
Step 1: Install the yum-cron package
yum -y install yum-cron
Step 2 (Optional): Add an exclusion rule for the kernel in /etc/yum.conf
echo 'exclude=kernel*' >> /etc/yum.conf
Step 3: Modify /etc/yum/yum-cron.conf and switch apply_updates to yes by executing the following command
sed -i s/"apply_updates = no"/"apply_updates = yes"/g /etc/yum/yum-cron.conf
Step 4: Start the yum-cron service:
systemctl start yum-cron.service
Step 5: Enable yum-cron at boot:
systemctl enable yum-cron
Congratulations, you have now enabled automatic yum updates.