同步 Tag Posts Archived

配置yum源并与公网同步更新

评论关闭

尽管sohu和163都推出了mirrors服务,但当要配置多台服务器时仍然需要占用很多公网带宽,因此配置一个本地yum源并时常与公网同步就显得非常有必要了。本文介绍的就是针对CentOS 5.4 配置yum源, 并且每日同步公网数据。每日的同步使用rsync协议,这里要注意并不是所有的mirrors站点都支持rsync协议,不过不用担心,下文有更新脚本,里面有我测试过的几个支持rsync协议的mirros站点。 配置yum源 本文要配置3个yum软件仓库,分别为:CentOS标准软件仓库、epel、以及rpmforge。经过多次尝试,定位了速度和更新频率都比较理想的几个站点。更多的mirrors站点参见以下网址: CentOS:http://www.centos.org/modules/tinycontent/index.php?id=32 epel:https://fedoraproject.org/wiki/EPEL rpmforge:http://apt.sw.be/ 同步yum源脚本 #!/bin/bash #========================================== # Program : update_yum_source.sh # Info : 定期同步官方 yum 源到本机 # Version : 2010.01.28 First Release #========================================== Date=`date +%Y%m%d` LogFile=”/data/logs/rsync_yum/$Date.log” CentOSTrunkVer=”5″ CentOSCurrentVer=”5.4″ ReceiveMail=”nathanzhou@mysite.com” RsyncBin=”/usr/bin/rsync” RsyncPerm=”-avrt –delete –exclude=debug/ –exclude=isos/” CentOS_Trunk_Ver_Path=”/data/soft/mirror.mysite.com/centos/$CentOSTrunkVer” CentOS_Current_Ver_Path=”/data/soft/mirror.mysite.com/centos/$CentOSCurrentVer” YumSiteList=”rsync://mirror.averse.net/centos” #============ epel ============== epelSite=”rsync://mirrors.sohu.com/fedora-epel/” epelLocalPath=”/data/soft/mirror.mysite.com/epel” # rpmforge rpmforgeSite=”rsync://apt.sw.be/freshrpms/pub/dag/redhat/el5/” rpmforgeLocalPath=”/data/soft/mirror.mysite.com/rpmforce” echo “—- $Date `date +%T` Begin —-” >>$LogFile # centos 5 $RsyncBin $RsyncPerm $YumSiteList/$CentOSTrunkVer/ \ $CentOS_Trunk_Ver_Path >> $LogFile # centos 5.4 $RsyncBin $RsyncPerm $YumSiteList/$CentOSCurrentVer/ \ $CentOS_Current_Ver_Path >> $LogFile # epel $RsyncBin $RsyncPerm –exclude=4/ –exclude=4AS/ –exclude=4AS/ \ –exclude=4WS/ –bwlimit=500 … Read More…

文章分类:经验分享
PHP外包开发服务网 苏ICP备09025214号 联系邮件:ask@china-php.com 返回顶部