rsync同步公網yum源搭建本地yum倉庫


同步公網 yum 源,上游 yum 源必須要支持 rsync 協議,否則不能使用 rsync 進行同步。

CentOS源:rsync://rsync.mirrors.ustc.edu.cn/centos/
EPEL源:rsync://rsync.mirrors.ustc.edu.cn/epel/

同步CentOS7

# 同步 epel
$ rsync -vrt --bwlimit=3000 --exclude=debug/ rsync://rsync.mirrors.ustc.edu.cn/epel/7/x86_64/ /data/mirrors/centos/epel7/x86_64/
 _______________________________________________________________
|         University of Science and Technology of China         |
|           Open Source Mirror  (mirrors.ustc.edu.cn)           |
|===============================================================|
|                                                               |
| Debian primary mirror in China mainland (ftp.cn.debian.org),  |
|     also mirroring a great many OSS projects & Linux distros. |
|                                                               |
| Currently we don't limit speed. To prevent overload, Each IP  |
| is only allowed to start upto 2 concurrent rsync connections. |
|                                                               |
| This site also provides http/https/ftp access.                |
|                                                               |
| Supported by USTC Network Information Center                  |
|          and USTC Linux User Group (http://lug.ustc.edu.cn/). |
|                                                               |
|    Sync Status:  https://mirrors.ustc.edu.cn/status/          |
|           News:  https://servers.ustclug.org/                 |
|        Contact:  lug@ustc.edu.cn                              |
|                                                               |
|_______________________________________________________________|


receiving incremental file list
./
x86_64/
x86_64/0/
x86_64/0/0ad-0.0.22-1.el7.x86_64.rpm
x86_64/0/0ad-data-0.0.22-1.el7.noarch.rpm
...

# 同步 base
$ rsync -vrt rsync://mirrors.ustc.edu.cn/centos/7/os/x86_64/ /data/mirrors/centos/7/os/x86_64/

# 同步 extras
$ rsync -vrt rsync://mirrors.ustc.edu.cn/centos/7/extras/x86_64/ /data/mirrors/centos/7/extras/x86_64/

# 同步 updates
$ rsync -vrt rsync://mirrors.ustc.edu.cn/centos/7/updates/x86_64/ /data/mirrors/centos/7/updates/x86_64/

同步 CentOS6

$ rsync -vrt --bwlimit=20000 rsync://rsync.mirrors.ustc.edu.cn/centos/6.9/ /data/mirrors/centos/6.9/

$ rsync -vrt --bwlimit=20000 --exclude=debug/ rsync://rsync.mirrors.ustc.edu.cn/epel/6/x86_64/ /data/mirrors/centos/epel6/x86_64/

配置 apache 發布鏡像目錄,當然也可以用 nginx。

$ vim /etc/httpd/conf/httpd.conf

# 注釋掉這一段
# <Directory />
   # AllowOverride none
   # Require all denied
# </Directory>

# 添加這一段
Alias /centos "/data/mirrors/centos/"
<Directory "/data/mirrors/centos">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

$ /etc/init.d/httpd reload

最后,配置repo就可以使用了。

[base]
name=CentOS-$releasever - Base
baseurl=http://10.100.10.89/centos/$releasever/os/$basearch/
enable=1
gpgcheck=0

#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=http://10.100.10.89/centos/$releasever/updates/$basearch/
enable=1
gpgcheck=0

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=http://10.100.10.89/centos/$releasever/extras/$basearch/
enable=1
gpgcheck=0

[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
baseurl=http://10.100.10.89/centos/epel/7/$basearch
enabled=1
gpgcheck=0


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM