nginx + rsync source for local and public network yum yum source

nginx + rsync source for local and public network yum yum source

1. Configure the nginx autoindex module, open the directory browsing
2. Using rsync package on the public network synchronization source, to a local directory
3. Configure clients to point to

1.nginx provide a directory browsing

[root@xuliangwei ~]# cat /etc/nginx/conf.d/yum.conf
server {
    listen 80;
    listen [::]:80;
    server_name mirrors.bgx.com;
    location / {
        root /repo;
        autoindex on; #开启目录浏览功能
    }

2. Synchronize packages from the warehouse to the local public network

Note, however, if a full synchronization, will be particularly footprint, so we can filter unwanted packages. rsync synchronization command (recommended to add a scheduled task)

#1.同步centos7的基础源
rsync -zaP --exclude-from /repo/exclude_7.txt rsync://rsync.mirrors.ustc.edu.cn/centos/7.6.1810/ /repo/centos

#2.同步centos7的epel源
rsync -zaP --exclude-from /repo/exclude_7_epel.txt rsync://rsync.mirrors.ustc.edu.cn/epel/7/ /repo/epel

#centos7排除的文件(保留os和extras)
[root@oldboyedu ~]# cat /repo/exclude_7.txt
atomic/
centosplus/
cloud/
configmanagement/
cr/
dotnet/
fasttrack/
isos/
nfv/
opstools/
paas/
rt/
sclo/
storage/
virt/
debug/
drpms/

#centos7_epel排除的文件(保留x86_64)
[root@xuliangwei ~]# cat /repo/exclude_7_epel.txt
SRPMS/
aarch64/
ppc64/
ppc64le/
state

3. Client Configuration local yum repository

[centos]
name = Local Base Repository
baseurl = http://mirrors.bgx.com/centos
enable = 1
gpgcheck = 0

[epel]
name = Local Epel Repository
baseurl = http://mirrors.bgx.com/epel
enable = 1
gpgcheck = 0

4. Extension

If you want to provide the downstream synchronization service, we can use rsync protocol to share out the directory, so that other people can also be synchronized (usually afford, after all, no money).

[root@xuliangwei ~]# cat /etc/rsyncd.conf
uid = nginx
gid = nginx
use chroot = no
max connections = 2000
timeout = 600
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log

ignore errors
read only = true            #只提供同步,所以只读即可
list = true                 #允许查看列表,认证的什么的不需要配置
hosts allow = 0.0.0.0/0     #允许任何人同步

##########提供同步的模块
[centos]
path = /repo/centos
[epel]
path = /repo/epel

Guess you like

Origin www.cnblogs.com/gongjingyun123--/p/11467105.html