1、更新系统
1.1 执行命令“yum update -y”进行手动更新系统
yum update -y
2、.安装yum-cron
2.1 执行命令“yum install yum-cron -y” 安装yum-cron
yum install yum-cron -y
2.2 修改yum-cron.conf 配置 文件位置“/etc/yum/yum-cron.conf”(vim 安装 yum -y install vim)
vim /etc/yum/yum-cron.conf
[commands]
# What kind of update to use:
# 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 = --sec-severity=Critical update-minimal
update_cmd = security
# Whether a message should be emitted when updates are available,
# were downloaded, or applied.
update_messages = yes
# Whether updates should be downloaded when they are available.
download_updates = yes
# Whether updates should be applied when they are available. Note
# that download_updates must also be yes for the update to be applied.
apply_updates = yes
# Maximum amout of time to randomly sleep, in minutes. The program
# will sleep for a random amount of time between 0 and random_sleep
# minutes before running. This is useful for e.g. staggering the
# times that multiple systems will access update servers. If
# random_sleep is 0 or negative, the program will run immediately.
# 6*60 = 360
random_sleep = 360
[emitters]
# Name to use for this system in messages that are emitted. If
# system_name is None, the hostname will be used.
system_name = None
# How to send messages. Valid options are stdio and email. If
# emit_via includes stdio, messages will be sent to stdout; this is useful
# to have cron send the messages. If emit_via includes email, this
# program will send email itself according to the configured options.
# If emit_via is None or left blank, no messages will be sent.
emit_via = stdio
# The width, in characters, that messages that are emitted should be
# formatted to.
output_width = 80
[email]
# The address to send email messages from.
# NOTE: 'localhost' will be replaced with the value of system_name.
email_from = root@localhost
需要修改的配置项
update_cmd = security
update_messages = yes
download_updates = yes
apply_updates = yes
2.3 设置好后就可以启动(设置开机启动)了
2.3.1 开机启动
systemctl enable yum-cron
2.3.2 启动 yum-cron
systemctl start yum-cron