要複製remote yum repo到local有兩種方式
- rsync
- reposync
但不是所有的remote repo都提供rsync存取權限,例如vault.centos.org就無法使用(https://lists.centos.org/pipermail/centos-mirror/2013-April/007069.html 裡面提到將rsync關掉了)
https://vault.centos.org/readme.txt
The Following External Vault mirrors (not monitored by the CentOS Infra team !) also provide direct downloads for all content, including isos and rsync access: USA: http://archive.kernel.org/centos-vault/ rsync://archive.kernel.org::centos-vault/ Europe: http://mirror.nsc.liu.se/centos-store/ rsync://mirror.nsc.liu.se::centos-store/
當遠端可使用rsync時,可透過以下命令
rsync -avP rsync://linuxsoft.cern.ch/centos-vault/6.10/updates/x86_64/ /data/centos/6/updates/x86_64
分別將os, updates, extras等同步到local dir
也可以直接rsync linuxsoft.cern.ch/centos-vault/6.10/ 排除掉一些pattern如i386、Source
rsync -avP –exclude=i386 rsync://linuxsoft.cern.ch/centos-vault/6.10/ /data/centos/6
另外的方式是透過reposync,他會讀取/etc/yum.conf,例如以下要同步updates repo
yum -y install yum-utils createrepo reposync
reposync –repoid=updates –arch=x86_64 -l -g
關於CentOS 6 repo sync要注意的是目前很多mirror site都是直接mirror官方的內容,但官方CentOS 6的repo都只有一個readme顯示不再提供
This directory (and version of CentOS) is deprecated. Please see this FAQ concerning the CentOS release scheme: https://wiki.centos.org/FAQ/General Please keep in mind that 6.0, 6.1, 6.2, 6.3, 6.4 , 6.5, 6.6, 6.7, 6.8 , 6.9 and 6.10 no longer get any updates, nor any security fix’s. The whole CentOS 6 is *dead* and *shouldn’t* be used anywhere at *all*
http://mirror.centos.org/centos/6/readme
CentOS6 可用的repo備份目前只有如vault.centos.org或是其他linuxsoft.cern.ch、archive.kernel.org有提供,但是cern的速度很慢,kernel.org常常會顯示max connection reached,備份時可以透過reposync先備份Packages資料夾(vault.centos.org的速度還算快),再用rsync將其他drpms、repodata等資料夾同步
local yum repo只需要設定好httpd,client端將yum.repos.d下的.repo指向對應的http路徑即可
參考: