The first step:
From the Yum source of the Rsync protocol, the synchronization script is as follows:
[email protected] crontab]# cat yum_update.sh
#!/bin/bash
Date= ' Date +%f '
echo $date >/var/log/yum_update.log
######### #Centos
Sour_url= "Rsync://centos.ustc.edu.cn/centos"
oslist= "6.6"
Os_plant= "x86_64"
Cmd= "RSYNC-AVRT"
Cmd=${cmd}${sour_url} "/" ${sour_dir} "/"
Outdir= "/home/himalayas/yum/centos/6/" # # if change, please notice the line of Epel, Rpmforge, rpmfusion
For yumdir in OS updates Extras centosplus contrib;
Do
test-d $outDir/$yumdir | | Mkdir-p $outDir/$yumdir
RSYNC-AVRT $sour _url/$osList/$yumdir/$os _plant $outDir/$yumdir >>/var/log/yum_update.log &
Done
######### #epel
test-d/home/himalayas/yum/epel/6/x86_64 | | Mkdir-p/home/himalayas/yum/epel/6/x86_64
RSYNC-AVRT--exclude=debug/--exclude=repoview/rsync://centos.ustc.edu.cn/fedora/epel/6/x86_64//home/himalayas/ yum/epel/6/x86_64 >>/var/log/yum_update.log &
######### #rpmforge
test-d/home/himalayas/yum/rpmforge/6/rpmforge/x86_64 | | Mkdir-p/home/himalayas/yum/rpmforge/6/rpmforge/x86_64
test-d/home/himalayas/yum/rpmforge/6/extras/x86_64 | | Mkdir-p/home/himalayas/yum/rpmforge/6/extras/x86_64
RSYNC-AVRT rsync://mirror.cpsc.ucalgary.ca/dag/redhat/el6/en/x86_64/rpmforge//home/himalayas/yum/rpmforge/6/ rpmforge/x86_64 >>/var/log/yum_update.log & # # #4678
RSYNC-AVRT rsync://mirror.cpsc.ucalgary.ca/dag/redhat/el6/en/x86_64/extras//home/himalayas/yum/rpmforge/6/ extras/x86_64 >>/var/log/yum_update.log &
######### #rpmfusion
test-d/home/himalayas/yum/rpmfusion/free/x86_64 | | Mkdir-p/home/himalayas/yum/rpmfusion/free/x86_64
test-d/home/himalayas/yum/rpmfusion/nofree/x86_64 | | Mkdir-p/home/himalayas/yum/rpmfusion/nofree/x86_64
RSYNC-AVRT rsync://centos.ustc.edu.cn/fedora/rpmfusion/free/el/updates/6/x86_64//home/himalayas/yum/rpmfusion/ free/x86_64 >>/var/log/yum_update.log &
RSYNC-AVRT rsync://centos.ustc.edu.cn/fedora/rpmfusion/nonfree/el/updates/6/x86_64//home/himalayas/yum/ rpmfusion/nofree/x86_64 >>/var/log/yum_update.log &
Note:
1, visit this URL: centos.ustc.edu.cn/centos/, when the version update all RPM package may have 6.5 go to 6.6 of the directory, this time to manually change the variable: oslist= "6.6", and then preferably manually executed once, See if updates can be synchronized.
2, you can use the following command to view the other Rsync source directory structure and all RPM packages
RSYNC-AVRT rsync://centos.ustc.edu.cn/centos/6.6/os/x86_64
Step two: Add to crontab synchronize once a day
XX * * * */bin/bash/kuxun/crontab/yum_update.sh
Centos Local Yum Source build-up