1.需求:内网10.10.10.78需要安装yum源,从10.20.20.216上利用nginx转发yum源获取。(10.20.20.216从内网173.1.1.10上获取yum源)
2.前提条件:10.10.10.78与10.20.20.216网络和端口互通。
3.10.20.20.216 实施步骤:
3.1 查看10.20.20.216上yum源的配置
配置Centos-Base.repo
vi /etc/yum.repos.d/Centos-Base.repo
[base] name=CentOS-7 - Base failovermethod=priority baseurl=http://173.1.1.10/centos/7/base7/ gpgcheck=0 [updates] name=CentOS-7 - Updates failovermethod=priority baseurl=http://173.1.1.10/centos/7/updates7/ gpgcheck=0 [epel] name=CentOS-7 - epel failovermethod=priority baseurl=http://173.1.1.10/centos/7/epel7/ gpgcheck=0 [extras] name=CentOS-7 - extras failovermethod=priority baseurl=http://173.1.1.10/centos/7/extras7/ gpgcheck=0
3.2 10.20.20.216上nginx 的配置
#yum forward server { listen 28888 max_ranges 1; server_tokens off; location / { proxy_pass http://173.1.1.10 } }
重载nginx
nginx -s reload
4.10.10.10.78 实施步骤
配置Centos-Base.repo
vi /etc/yum.repos.d/Centos-Base.repo
[base] name=CentOS-7 - Base failovermethod=priority baseurl=http://10.20.20.216:28888/centos/7/base7/ gpgcheck=0 [updates] name=CentOS-7 - Updates failovermethod=priority baseurl=http://10.20.20.216:28888/centos/7/updates7/ gpgcheck=0 [epel] name=CentOS-7 - epel failovermethod=priority baseurl=http://10.20.20.216:28888/centos/7/epel7/ gpgcheck=0 [extras] name=CentOS-7 - extras failovermethod=priority baseurl=http://10.20.20.216:28888/centos/7/extras7/ gpgcheck=0
5.遇到问题
yum install gcc 时报
网络限制,需要网管放行。
6.重新yum install gcc 可以下载
标签:10.20,http,CentOS,centos,nginx,yum,转发,20.216 From: https://www.cnblogs.com/joyware/p/16910495.html