前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >CentOS7搭建开源镜像站

CentOS7搭建开源镜像站

作者头像
陳斯托洛夫斯記
发布2022-10-27 15:23:05
1.9K0
发布2022-10-27 15:23:05
举报
文章被收录于专栏:XBDXBD

安装 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
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 安装 Nginx,开启下载功能
  • 同步,编写一个同步脚本
  • 客户端配置
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档