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

Posted xuyaowen

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos 下创建本地镜像源,结合 nginx相关的知识,希望对你有一定的参考价值。

1. 创建同步文件

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

[[email protected] 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 配置详解

[[email protected] centos]# reposync -c centos-repo.conf 

3. 创建 repo 

cd $i && createrepo .

4. 定时同步

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

 

以上是关于centos 下创建本地镜像源,结合 nginx的主要内容,如果未能解决你的问题,请参考以下文章

CentOS 7环境下配置镜像为本地源yum

CentOS 7使用ISO镜像配置本地yum源

Centos8创建本地源

用centos镜像 制作本地yum源

本地yum源安装

Centos-Stream 配置本地yum源和配置阿里云yum源