Nginx制作内网yum源

Nginx制作内网yum源

实战:(服务器直接干)

  • 1)局域网内部开放能访问aliyun的服务器
#配置网络源
cd /etc/yum.repo.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos7.repo

yum clean all
yum makecache
yum repolist

#创建本地yum文件目录
mkdir /yum_data/{centos7,epel}

#安装reposync 工具
yum -y install  yum-utils createrepo

#同步yum源
reposync -r base -r updates -p /yum_data/centos7/ 
--
reposync -r epel  -p /yum_data/

#生成元数据--每次同步源都要重新执行,生成repodata
createrepo /yum_data/centos7/
--
createrepo /yum_data/epel/ 

下载对应的KEY到/yum_data/centos7/
cd /yum_data/centos7/
wget http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
--
cd /yum_data/
wget https://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-7
  • 2)部署Nginx--nginx部署详解另述
location / {
            autoindex on;         #开启目录列表
            root   /yum_data;     #更改发布目录
            index  index.html index.htm;
        }

重启nginx服务

  • 3)另外一台无法访问外网服务器配置yum源
[root@zabbix yum.repos.d]# cat local.repo 
[base]
name=CentOS7
baseurl=http://xx.xx.xx.xx/centos7/
gpgcheck=1
gpgkey=http://xx.xx.xx.xx/centos7/RPM-GPG-KEY-CentOS-7
--
[root@zabbix yum.repos.d]# cat local_epel.repo 
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
metalink=http://xx.xx.xx.xx/epel/
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=http://xx.xx.xx.xx/epel/rpm-gpg-key-epel-7
posted @   IT_baibai  阅读(461)  评论(0编辑  收藏  举报
编辑推荐:
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
点击右上角即可分享
微信分享提示