/opt/opmgmt/yum/rsync_centos.sh
#!/bin/bash repo_root='/opt/opmgmt/yum/centos/' sync_cmd='rsync -arv --delete-after --delete-excluded' sync_srv='rsync://mirrors.shu.edu.cn/centos/' exclude='--exclude [23456]/ --exclude [2345]\.*/ --exclude i386/ --exclude drpms/ --exclude SCL/ --exclude centosplus/ --exclude contrib/ --exclude cr/ --exclude fasttrack/ --exclude isos/ --exclude virt/ --exclude paas/ --exclude 7.[012]*/ --exclude atomic/ --exclude cloud/ --exclude storage/' [ -d $repo_root ] && mkdir -p $repo_root $sync_cmd $exclude $sync_srv $repo_root &/opt/opmgmt/yum/rsync_epel.sh
#!/bin/bash repo_root='/opt/opmgmt/yum/epel/' sync_cmd='rsync -arv --delete-after --delete-excluded' sync_srv='rsync://mirrors.shu.edu.cn/epel/' exclude='--exclude [45]*/ --exclude testing/ --exclude SRPMS/ --exclude i386/ --exclude ppc64*/ --exclude aarch64/ --exclude debug/ --exclude=repoview' [ -d $repo_root ] && mkdir -p $repo_root $sync_cmd $exclude $sync_srv $repo_root &/etc/cron.d/sync-yum-repo
0 1 * * * root /bin/sh /opt/opmgmt/yum/rsync_centos.sh 0 2 * * * root /bin/sh /opt/opmgmt/yum/rsync_epel.sh/etc/nginx/conf.d/yum.conf
server { listen 192.168.0.100:80; server_name yum.localhost; #allow 10.0.1.0/24; #deny all; charset utf-8; access_log /var/log/nginx/$server_name.access.log main; location / { root /opt/www/yum; index index.html index.htm; } error_page 404 /404.html; location = /404.html { root /usr/share/nginx/html; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } }/opt/opmgmt/yum/repo/centos.repo
[base] name=CentOS-$releasever - Base baseurl=http://yum.localhost/centos/$releasever/os/$basearch gpgcheck=0 enabled=1 priority=1 [updates] name=CentOS-$releasever - Updates baseurl=http://yum.localhost/centos/$releasever/updates/$basearch gpgcheck=0 enabled=1 priority=1 [extras] name=CentOS-$releasever - Extras baseurl=http://yum.localhost/centos/$releasever/extras/$basearch gpgcheck=0 enabled=1 priority=1 [centos-sclo-sclo] name=CentOS-$releasever - SCLo sclo baseurl=http://yum.localhost/centos/$releasever/sclo/$basearch/sclo gpgcheck=0 enabled=1 priority=2 [centos-sclo-rh] name=CentOS-$releasever - SCLo rh baseurl=http://yum.localhost/centos/$releasever/sclo/$basearch/rh gpgcheck=0 enabled=1 priority=2另外一种方法
yum install yum-utils reopsync posted on 2014-10-28 12:06 北京涛子 阅读( ...) 评论( ...) 编辑 收藏转载于:https://www.cnblogs.com/liujitao79/p/4056488.html