Configuring automatic security updates on CENTOS/RHEL7 systems
On the Centos/rhel 7/6 system, you need to install the following installation package:
# yum Update-y; Yum Install Yum-cron-y
After the installation is complete, open/etc/yum/yum-cron.conf, and then find the following lines, and you must make sure that their values are the same as those shown below
Update_messages = yes
download_updates = yes
apply_updates = yes
The first line indicates that the Automatic Update command line should look like this:
# Yum--security Upgrade
Other lines ensure that you can notify and automatically download and install security upgrades.
To enable notifications from root@localhost to be sent to the same account via email (again, you can choose another account, if you wish), the following lines are also required.
Emit_via = Email
email_from = Root@localhost
email_to = root
Enable automatic security update on Centos/rhel 6
By default, the cron task is configured to download and install all updates immediately, but we can change this behavior by changing the following two parameters to Yes in the/etc/sysconfig/yum-cron configuration file.
# do not install, only check (valid value: Yes|no)
check_only=yes
# do not install, only do check and download (valid value: Yes|no)
# request Check_only=yes (first check before you know what to download)
Download_only=yes
In order to enable mail notifications about installation package updates, you need to set the mailto parameter to a valid email address.
# MAILTO is not set by default, Crond will send output to himself
# (execute cron user, here is root)
# example: Mailto=root
mailto=admin@tecmint.com
Finally, open and enable the Yum-cron service:
-------------on Centos/rhel 7-------------
systemctl start Yum-cron
systemctl enable Yum-cron
---------- ---on Centos/rhel 6-------------
# service Yum-cron start
# chkconfig--level Yum-cron on
Congratulations, you have successfully set up an automatic upgrade on the Centos/rhel 7/6 system. Summarize
In this article, we discussed how to keep your server updated or upgraded to the latest security patches on a regular basis. In addition, to ensure that you know when new patches are applied, you also learn how to configure email notifications.