title: 配置squid代理yum、http及https #标题tags: #标签
date: 2021-12-17
categories: linux大杂烩 # 分类
安装及配置squid
需要在能出公网的机器操作。
$ yum -y install squid # 安装squid
# 配置squid
$ cat > /etc/squid/squid.conf << EOF
acl localnet src 192.168.0.0/16 # 指定允许访问本代理的网段
http_port 0.0.0.0:1087
access_log /var/log/squid/access.log
http_access allow all
EOF
# 启动squid
systemctl start squid
$ ss -lntp | grep 1087
LISTEN 0 4096 *:1087 *:* users:(("squid",pid=7387,fd=10))
配置需要访问代理的客户端
$ echo "proxy=http://192.168.20.10:1087" >> /etc/yum.conf
cat > /etc/wgetrc << EOF
http_proxy=http://192.168.20.10:1087
https_proxy=http://192.168.20.10:1087
ftp_proxy=http://192.168.20.10:1087
EOF
cat > /etc/profile << EOF
http_proxy=http://192.168.20.10:1087
https_proxy=http://192.168.20.10:1087
ftp_proxy=http://192.168.20.10:1087
no_proxy="127.0.0.1,localhost"
EOF
source /etc/profile
客户端测试
# 下载
$ wget https://mirrors.tuna.tsinghua.edu.cn/ELK/yum/kibana-4.5/kibana-4.5.0-1.i386.rpm --no-check-certificate、
# yum安装
$ yum -y install tcpdump