title: 配置squid代理yum、http及https #标题tags: #标签
date: 2021-12-17
categories: linux大杂烩 # 分类

记录下搭建yum、http及https代理的配置。

安装及配置squid

需要在能出公网的机器操作。

  1. $ yum -y install squid # 安装squid
  2. # 配置squid
  3. $ cat > /etc/squid/squid.conf << EOF
  4. acl localnet src 192.168.0.0/16 # 指定允许访问本代理的网段
  5. http_port 0.0.0.0:1087
  6. access_log /var/log/squid/access.log
  7. http_access allow all
  8. EOF
  9. # 启动squid
  10. systemctl start squid
  11. $ ss -lntp | grep 1087
  12. 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