CentOS local yum source construction
Step 1:
From the yum source of rsync, the synchronization script is as follows:
[Root @ 50-250 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: // logs/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: // logs/home/himalayas/yum/rpmfusion/free/x86_64>/var/log/yum_update.log &
Rsync-avrt rsync: // logs/home/himalayas/yum/rpmfusion/nofree/x86_64>/var/log/yum_update.log &
Note:
1. Visit this Website: centos.ustc.edu.cn/centos/. After the version is updated, all rpm packages may be transferred from 6.5 to the 6.6 directory. In this case, manually change the variable: osList = "6.6 ", then it is best to manually execute it once to see if updates can be synchronized.
2. You can run the following command to view the directory structure of the Peer rsync source and all rpm packages.
Rsync-avrt rsync: // centos.ustc.edu.cn/centos/6.6/ OS /x86_64
Step 2: add to crontab to synchronize once a day
00 00 ***/bin/bash/kuxun/crontab/yum_update.sh