linux
  • Introduction
  • Yum
    • 基础yum源的配置
    • 为yum源配置代理
    • Centos指定版本的yum源
    • 环境变量
    • 本地yum源
    • 制作yum源
      • 同步yum源
    • epel源
  • Iptables
    • 基本匹配条件
    • Match-Extensions
      • Addrtype
      • Set
      • TCP
    • Target-Extensions
      • DNAT
      • LOG
    • Iptables规则持久化
    • 连接追踪
  • LVS
    • Ipvsadm命令
  • 磁盘与分区
    • 创建分区
    • 格式化与挂载
    • fstab
    • LVM
      • LVM扩容
    • swap分区
    • tmpfs
  • 网络相关
    • 重命名网卡
    • resolv.conf
    • Tcpdump
    • dig与nslookup
  • Other
    • CPU与内存
    • 进程
      • 僵尸进程
    • SSH密钥登录
    • 用户管理
    • Crontab
  • Nofile
    • 原理
  • 常用软件安装篇
    • MYSQL
    • 系统与内核
      • 指定内核启动
    • NFS
    • Haproxy
    • Keepalived
    • Squid
    • Redsocks
    • Shadowsocks
    • 时钟同步
  • 内存
Powered by GitBook
On this page
  • 安装
  • 配置
  • 启动
  • 验证

Was this helpful?

  1. 常用软件安装篇

Squid

安装

yum -y install squid

安装的版本为

squid.x86_64 7:3.5.20-2.el7_3.3 @updates

配置

  • /etc/squid/squid.conf

用如下两行覆盖

http_port 3128 # 如果只监听ipv4,则该行设为 http_port 0.0.0.0:3128
http_access allow all
  • /usr/lib/systemd/system/squid.service

[Unit]
Description=Squid caching proxy
After=syslog.target network.target nss-lookup.target

[Service]
Type=forking
LimitNOFILE=16384
EnvironmentFile=/etc/sysconfig/squid
ExecStartPre=/usr/libexec/squid/cache_swap.sh
ExecStart=/usr/sbin/squid $SQUID_OPTS -f $SQUID_CONF
ExecReload=/usr/sbin/squid $SQUID_OPTS -k reconfigure -f $SQUID_CONF
ExecStop=/usr/sbin/squid -k shutdown -f $SQUID_CONF
TimeoutSec=0

[Install]
WantedBy=multi-user.target

启动

systemctl start squid

验证

[root@master squid]# ps -ef | grep squid
root 31417 82275 0 10:01 pts/1 00:00:00 grep --color=auto squid
root 128368 1 0 09:12 ? 00:00:00 /usr/sbin/squid -f /etc/squid/squid.conf
squid 128370 128368 0 09:12 ? 00:00:00 (squid-1) -f /etc/squid/squid.conf
squid 128371 128370 0 09:12 ? 00:00:00 (logfile-daemon) /var/log/squid/access.log
PreviousKeepalivedNextRedsocks

Last updated 5 years ago

Was this helpful?