(轉)CentOS / RHEL 7/6 自動更新安全補丁


在CentOS / RHEL 7/6,則需要安裝以下包:
# yum update -y && yum install yum-cron -y


在CentOS / RHEL 7上啟用自動安全更新
一旦安裝完成后,打開/etc/yum/yum-cron.conf並找到這些行-你必須確保該值相符這里列出:
update_cmd = security
update_messages = yes
download_updates = yes
apply_updates = yes

第一行表示無人值守的更新命令將是:

# yum --security upgrade而其他線路則啟用安全升級的通知和自動下載和安裝。

還需要以下幾行,以表明通知將通過電子郵件發送從root@localhost同一帳戶(同樣,你也可以選擇另外一個,如果你想)。


emit_via = email
email_from = root@localhost
email_to = root


在CentOS / RHEL 6上啟用自動安全更新
默認情況下,cron是配置為下載並立即安裝所有更新,但我們可以通過這兩個參數修改,在/etc/sysconfig/yum-cron 配置文件,修改為yes 。
# Don't install, just check (valid: yes|no)
CHECK_ONLY=yes
# Don't install, just check and download (valid: yes|no)
# Implies CHECK_ONLY=yes (gotta check first to see what to download)
DOWNLOAD_ONLY=yes


要啟用電子郵件通知有關安全軟件包的更新,這個mailto參數設置為一個有效的電子郵件地址。
# by default MAILTO is unset, so crond mails the output by itself
# example: MAILTO=root
MAILTO=XXX@XXX.com

 

最后,啟動並啟用yum-cron服務:
------------- On CentOS/RHEL 7 -------------
systemctl start yum-cron
systemctl enable yum-cron
------------- On CentOS/RHEL 6 -------------
# service yum-cron start
# chkconfig --level 35 yum-cron on

 

參考資料:

https://blog.csdn.net/e_wsq/article/details/80007473


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM