背景:最近项目上遇到个问题,需要进行linux内核更新,然而内网环境只给开放了有限的端口,其他的内网主机无法出网。在需要用到yum的时候非常不方便。因此做一下nginx代理yum源
环境:两台机器 centos7.5
host1: 192.168.32.11 (可以出网 做nginx)
host2: 192.168.32.12 (无法出网,需要安装软件,指定yum代理为host1)
修改主机yum配置文件
- 在host2的 /etc/yum.conf添加一行
proxy=192.168.32.11:80 #80端口为nginx监听端口
- 修改repo文件(记得备份之前的)这里我使用的aliyun的
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod