配置
yum-cron
禁止Yum
在后台自动下载更新
新安装 CentOS 7 后,Yum
自动下载更新默认是开启状态,需要借助yum-cron
将其关闭,否则后台会定期产生下行流量。
1. 安装 yum-cron
首先安装yum-cron
包:
> yum install -y yum-cron
> yum info yum-cron
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* epel: nrt.edge.kernel.org
* rpmforge: mirror.fairway.ne.jp
Installed Packages
Name : yum-cron
Arch : noarch
Version : 3.4.3
Release : 163.el7.centos
Size : 51 k
Repo : installed
From repo : base
Summary : Files needed to run yum updates as a cron job
URL : http://yum.baseurl.org/
License : GPLv2+
Description : These are the files needed to run yum updates as a cron job.
: Install this package if you want auto yum updates nightly via : cron.
2. 修改 yum-cron.conf
编辑/etc/yum/yum-cron.conf
文件,将update_messages
和download_updates
均修改为no
:
> vim /etc/yum/yum-cron.conf
......
# Whether a message should be emitted when updates are available,
# were downloaded, or applied.
update_messages = no
# Whether updates should be downloaded when they are available.
download_updates = no
......
3. 重启服务
重启yum-cron
服务:
systemctl enable yum-cron
systemctl restart yum-cron