# 安装自动打补丁软件
yum install yum-cron yum-plugin-security

————
CentOS7

vi /etc/yum/yum-cron.conf
# 只适用于风险级别Critical
update_cmd = minimal-security-severity:Critical
# 自动打补丁
apply_updates = yes
# 主机名
system_name = centos7
# 邮件发送源/收件人地址
email_from = root@localhost
email_to = root

systemctl enable yum-cron && systemctl start yum-cron

———–
CentOS6

vi /etc/sysconfig/yum-cron
# 只适用于风险级别Critical
YUM_PARAMETER="–sec-severity=Critical update-minimal"
# 邮件收件人
MAILTO=root
# 主机名
SYSTEMNAME= centos6

chkconfig yum-cron on && servie yum-cron start

====================
PS:
default 默认的更新,类似yum upgrade
security 安全更新, 类似yum –security upgrade
security-severity:Critical 重要的安全更新,类似yum –sec-severity=Critical upgrade
minimal 最小化更新,类似yum –bugfix update-minimal
minimal-security 最小化安全更新,类似yum –security update-minimal
minimal-security-severity:Critical 最小化重要安全更新,类似yum –sec-severity=Critical update-minimal