大网数据广告活动
服务器运维问答

Centos repository server auto update

· 52CE 我爱测

I have repository server running on Centos7.4 and all the centos clients in my network do yum update through repo server. The question when there is an updates, do I need to download manually to Server or is there any tool that a…

问题原文

原帖链接 · David A · CC BY-SA 4.0

I have repository server running on Centos7.4 and all the centos clients in my network do yum update through repo server.

The question when there is an updates, do I need to download manually to Server or is there any tool that able to check new updates from repo mirror sites and automatically push down to the repo server's designated folder?

Thank you :)

已采纳解答

原帖链接 · Leo Gallego · CC BY-SA 4.0

If you already have a local network repository mirror working, then you should configure the clients to use it, and they will update from there.

In your clients:

cd /etc/yum.repos.d

vim mylocal.repo

Fill in:

[mylocalrepo]
name=Local CentOS Repository
baseurl=http://my-repo-server/CentOS/7/4
gpgcheck=0

Where my-repo-server is the URL or IP of your repo server.

You should probably remove/comment the official public repos URL from the clients as well if you don`t want them updating through the Internet.

Forgot the auto-update part:

For the auto-update / auto-upgrade to work you should do a few more changes in the clients.

Install yum-cron

sudo yum install yum-cron

Configure yum-cron

sudo vim /etc/yum/yum-cron.conf

You can select which packages to auto-upgrade in yum-cron among other self-documented options in that file, this are the upgrade options to choose from:

# default                            = yum upgrade
# security                           = yum --security upgrade
# security-severity:Critical         = yum --sec-severity=Critical upgrade
# minimal                            = yum --bugfix upgrade-minimal
# minimal-security                   = yum --security upgrade-minimal
# minimal-security-severity:Critical =  --sec-severity=Critical upgrade-minimal

I would probably not recommend leaving the default, and instead use the security one. As upgrading all the packages automatically could lead to unforeseen issues.

Start and enable the service for auto start on boot:

sudo systemctl start yum-cron
sudo systemctl enable yum-cron

ps. Upgrade and update are two different things. The first one executes the package upgrades, while the latter just updates the repository index (to see which changes are upstream).

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-05-13)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。