squid代理使用yum源
2022/6/28 5:20:24
本文主要是介绍squid代理使用yum源,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
原文地址:https://www.cnblogs.com/effortsing/p/10060821.html
参考地址:https://blog.csdn.net/J080624/article/details/53728535
环境: 内网中的服务器只有一台(bcec001)可以连外网(可以使用公网yum源),其他服务器(bcec002)无法连外网。操作系统Centos7.4
安全组都打开3128端口
公网地址:114.115.178.26 私有地址:10.1.1.3
另一台服务器内网地址:10.1.1.5
服务端配置:
[root@host-10-1-1-161 ~]# systemctl stop firewalld
在114.115.178.26安装 Squid.
[root@host-10-1-1-161 ~]# yum install squid -y
配置squid
[root@host-10-1-1-161 ~]#vi /etc/squid/squid.conf
删除原有内容,添加如下内容,
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 ecs-01.novalocal #squid那台主机名
squid -k parse # 配置文件解析日志中,没有出现ERROR 就没有问题
初始化
[root@host-10-1-1-161 ~]# squid -z
什么都没显示,说明初始化成功。 注意:会出现一屏字符,不影响 银盾云主机显示一行文字,不影响
启动Squid
[root@host-10-1-1-161 ~]#/etc/init.d/squid start
客户端配置:
4、在其它想使用此代理的主机上配置yum的代理
vi /etc/yum.conf加入以下内容:proxy=http://10.1.1.3:3128
vi /etc/wgetrc 加入以下内容:http_proxy=http://10.1.1.3:3128
vim /etc/profile
#查找并修改或追加以下语句(将10.0.0.1修改为你的Squid配置的监听地址或服务器的IP):
export http_proxy=http://10.0.0.3:3128/
export ftp_proxy=http://10.0.0.3:3128/
export https_proxy=http://10.0.0.3:3128/
[root@host-10-1-1-111 ~]# sed -i '$a\proxy=http://10.1.1.3:3128' /etc/yum.conf
[root@host-10-1-1-111 ~]# sed -i '$a\proxy=http://10.1.1.3:3128' /etc/wgetrc
[root@host-10-1-1-111 ~]# sed -i '$a\proxy=http://10.1.1.3:3128' /etc/profile
[root@host-10-1-1-111 ~]# sed -i '$a\ftp=http://10.1.1.3:3128' /etc/profile
[root@host-10-1-1-111 ~]# source /etc/profile
[root@host-10-1-1-111 ~]# source /etc/profile
注意:对于华为云要 source 两次
5、客户端、服务端的防火墙打开端口,实在不行就直接关掉防火墙,
[root@ecs-b8b7 ~]# firewall-cmd --add-port=3128/tcp -- permanent
[root@ecs-b8b7 ~]# systemctl stop firewalld
这篇关于squid代理使用yum源的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-05-15鸿蒙生态设备数量超8亿台
- 2024-05-13TiDB + ES:转转业财系统亿级数据存储优化实践
- 2024-05-09“2024鸿蒙零基础快速实战-仿抖音App开发(ArkTS版)”实战课程已上线
- 2024-05-09聊聊如何通过arthas-tunnel-server来远程管理所有需要arthas监控的应用
- 2024-05-09log4j2这么配就对了
- 2024-05-09nginx修改Content-Type
- 2024-05-09Redis多数据源,看这篇就够了
- 2024-05-09Google Chrome驱动程序 124.0.6367.62(正式版本)去哪下载?
- 2024-05-09有没有大佬知道这种数据应该怎么抓取呀?
- 2024-05-09这种运行结果里的10.100000001,怎么能最快改成10.1?