构建本地仓库的步骤:
安装nginx
2 .在本机上配置AlibabaCloud (阿里巴巴云) yum源码
wget-o/etc/yum.repos.d/centos-base.repo http://mirrors.a liyun.com/repo/centos-7.repow get-o/etc /
3 .将公共网络镜像到本地专用仓库
使用repoync命令时,Reposync用于同步远程yum存储库和本地存储库
repo sync-NP/data/centos/7/base/# #其中同步的源文件是在上述过程中配置的yum源,/data/centos/7/base/是产生的本地文件
-n:仅下载最新的软件包
-p:下载软件包的路径:缺省为当前目录
4 .将作为yum仓库文件的rpm软件包的路径设置为nginx分发目录
服务器{ listen 80; server_name mirrors.aaaa.com; root /data/centos/7/base/#此处是yum源存储目录location/{ autoindex on; #打开目录浏览功能autoindex_exact_size off; # off :文件大小autoindex_localtime on; # on,off :是否将服务器文件时间作为显示时间charset utf-8,gbk; #显示中文文件名index index.html; } error _ page 500502503504/50x.html; location=/50x.html { root html; }5.设置定时同步任务
调度脚本: yum_update.sh
#! /漠然花卷/bash echo ' updatingaliyumsource ' datetime=` date % f _ % t ` exec/var/log/aliyumrepo _ $ datetime.lote then createrepo---- update/data/centos/7/base/base/base createrepo---update/data/centos/7/base/extras cras base/EPE lecho ' sucess 3360 $ datetimealiyum _ yumupdatesuccessful '/virtual aliyumrepo _ $ datetime.log else echo ' error
0 3 * * 1 /漠然花卷/sh /data/crond/yum_update.sh ##每周一凌晨3点执行
#参考:
3359 blog.csdn.net/moyuanbomo/article/details/81667006
33559 www.cn blogs.com/ll DSN/p/10479493.html