环境: 内网中的服务器只有一台(A)可以连外网(可以使用公网yum源),其他服务器(B)无法连外网。操作系统Centos6.9
1.在能联网的机器上(A)安装 Squid
yuminstall squid
修改A与B的主机识别vi /etc/host
添加ip 主机名 例如: 192.168.10.222 lljqwer(2台都要添加)
2.配置squid
cache_mem 64 MB
maximum_object_size 4 MB
cache_dir ufs /var/spool/squid 100 16 256
access_log /var/log/squid/access.log
http_access allow all
visible_hostname InterFinance04
visible_hostname lljqwer
http_port 3128
cache_mgr 280797927@qq.com
3.启动Squid
service squid restart
验证方式 squid -z
4、在其它想使用此代理的主机上配置yum的代理
vi/etc/yum.conf
添加内容
proxy=http://:3128
如 A主机ip proxy=http://192.168.10.222:3128
再在:vi /etc/wgetrc 加入以下内容:http_proxy=http://192.168.10.222:3128
5 ,再把A代理主机上的epel联网的源拷贝到B机器上/etc/yum.repos.d目录下就好了