One of the serious needs of a Linux system is to be kept up to date regularly with the latest security patches or updates available for the corresponding distribution.
In a previous article, we’ve explained how to configure automatic security update in Debian/Ubuntu, in this article we will explain how to set up your CentOS/RHEL 7/6 distribution to auto update essential security packages when needed.
Other Linux distributions in the same families (Fedora or Scientific Linux) can be configured similarly.
Configure Automatic Security Updates on CentOS/RHEL Systems
On CentOS/RHEL 7/6, you will need to install the following package:
Enable Automatic Security Updates on CentOS/RHEL 7
Once the installation is complete, open /etc/yum/yum-cron.conf and locate these lines – you will have to make sure that the values matches those listed here:
The first line indicates that the unattended update command will be:
whereas the other lines enable notifications and automatic download and installation of security upgrades.
The following lines are also required to indicate that notifications will be sent via email from root@localhost to the same account (again, you may choose another one if you want).
Enable Automatic Security Updates on CentOS/RHEL 6
By default, the cron is configured to download and install all updates immediately, but we can change this behavior in /etc/sysconfig/yum-cron configuration file by modifying these two parameters to
yes
.
To enable email notification that about the security package updates, set the MAILTO parameter to a valid mail address.
Finally, start and enable the yum-cron service:
Congrats! You have successfully set up unattended upgrades on CentOS/RHEL 7/6.