安装 Nginx,开启下载功能
代码语言:javascript
复制yum install pcre-devel zlib openssl-devel createrepo rsync -y
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html/;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
}
}
同步,编写一个同步脚本
代码语言:javascript
复制# 创建目录
mkdir -p /usr/share/nginx/html/epel/7/SRPMS/
rsync -avrtz rsync://mirror.de.leaseweb.net/epel/7/SRPMS/ /usr/share/nginx/html/epel/7/SRPMS/
createrepo /usr/share/nginx/html/epel/7/SRPMS/
mkdir -p /usr/share/nginx/html/epel/7/x86_64/
rsync -avrtz rsync://mirror.de.leaseweb.net/epel/7/x86_64/ /usr/share/nginx/html/epel/7/x86_64/
createrepo /usr/share/nginx/html/epel/7/x86_64
客户端配置
代码语言:javascript
复制vim /etc/yum.repos.d/epel.repo
[epel-1]
name=local mirror
baseurl=http://192.168.1.50/epel/7/x86_64/
enabled=1
gpgcheck=0
[epel-2]
name=local mirror
baseurl=http://192.168.1.50/epel/7/SRPMS/
enable=1
gpgcheck=0
yum clean all
yum makecache