首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >centos 下创建本地镜像源,结合 nginx

centos 下创建本地镜像源,结合 nginx

作者头像
西湖醋鱼
发布2020-12-30 10:51:33
发布2020-12-30 10:51:33
1.2K0
举报

1. 创建同步文件

参考清华的Centos源,配置同步文件。https://mirrors.tuna.tsinghua.edu.cn/help/centos/

代码语言:javascript
复制
[root@localhost centos]# cat centos-repo.conf
[base]
name=CentOS-$releasever - Base
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=0
enabled=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

2. 同步源到本地文件夹(此文件夹需要结合nginx 配置成网络可访问的文件服务器:nginx location 配置详解

代码语言:javascript
复制
[root@localhost centos]# reposync -c centos-repo.conf 

3. 创建 repo 

代码语言:javascript
复制
cd $i && createrepo .

4. 定时同步

代码语言:javascript
复制
crontab -e
1 2 * * * /usr/bin/reposync -np /home/centos

5. 重新配置镜像地址

本方法的一个例子,可以参考lustre文件系统安装 

参考链接:

https://www.cnblogs.com/juandx/p/6136621.html

https://blog.csdn.net/u012402276/article/details/53158682

https://blog.csdn.net/moyuanbomo/article/details/81667006

可参考:可选配置文件

代码语言:javascript
复制
/usr/bin/reposync -np /home/centos -c centos-repo.conf
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019-06-30 ,如有侵权请联系 cloudcommunity@tencent.com 删除

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

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

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

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档