配置yum源(Nginx代理)

在内网环境中,由于端口限制,yum更新变得困难。本文介绍如何通过在可上网的CentOS7.5主机(host1)配置Nginx代理,帮助无法出网的主机(host2)进行yum操作。主要步骤包括:在host2的`/etc/yum.conf`中添加代理配置,并在host1上配置并启动Nginx代理。
摘要由CSDN通过智能技术生成

背景:最近项目上遇到个问题,需要进行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
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值