Squid是一个缓存和转发HTTP Web代理。Squid具有很多功能,可用于多种情况,例如通过缓存重复的请求来加速Web服务器,缓存Web和dns查找,过滤流量,阻止网站等。它是用C ++编写的,并在GNU GPL下分发执照。
Squid被认为是最可靠的内容控制软件,并且自最近20年以来已被许多组织使用。
本文特别强调CentOS 8上Squid代理服务器的安装和初始配置。因此,如果您愿意在Squid代理中配置一些高级设置,则强烈建议您购买[Squid Proxy Server 3.1:入门指南].
我们已提供了具有以下规范的CentOS 8虚拟机。
使用ssh作为root用户连接squid-proxy.lianglab.cn。
Squid软件包在标准yum存储库中可用,因此,我们正在使用yum命令安装Squid代理。
[root@squid-proxy ~]# dnf install -y squid Last metadata expiration check: 2:12:45 ago on Thu 17 Dec 2020 09:03:48 PM CST. Dependencies resolved. ============================================================================================ Package Arch Version Repository Size ============================================================================================ Installing: squid x86_64 7:4.4-8.module_el8.2.0+319+d18e041f.1 AppStream 3.5 M Installing dependencies: libecap x86_64 1.0.1-2.module_el8.2.0+319+d18e041f AppStream 29 k Enabling module streams: squid 4 Transaction Summary Install 2 Packages Total download size: 3.6 M Installed size: 12 M Downloading Packages: (1/2): libecap-1.0.1-2.module_el8.2.0+319+d18e041f.x86_64.r 1.5 MB/s | 29 kB 00:00 (2/2): squid-4.4-8.module_el8.2.0+319+d18e041f.1.x86_64.rpm 41 MB/s | 3.5 MB 00:00 Total 40 MB/s | 3.6 MB 00:00 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Running scriptlet: squid-7:4.4-8.module_el8.2.0+319+d18e041f.1.x86_64 1/1 Preparing : 1/1 Installing : libecap-1.0.1-2.module_el8.2.0+319+d18e041f.x86_64 1/2 Running scriptlet: libecap-1.0.1-2.module_el8.2.0+319+d18e041f.x86_64 1/2 Running scriptlet: squid-7:4.4-8.module_el8.2.0+319+d18e041f.1.x86_64 2/2 Installing : squid-7:4.4-8.module_el8.2.0+319+d18e041f.1.x86_64 2/2 Running scriptlet: squid-7:4.4-8.module_el8.2.0+319+d18e041f.1.x86_64 2/2 Verifying : libecap-1.0.1-2.module_el8.2.0+319+d18e041f.x86_64 1/2 Verifying : squid-7:4.4-8.module_el8.2.0+319+d18e041f.1.x86_64 2/2 Installed products updated. Installed: libecap-1.0.1-2.module_el8.2.0+319+d18e041f.x86_64 squid-7:4.4-8.module_el8.2.0+319+d18e041f.1.x86_64 Complete!
启用并启动Squid代理服务。
[root@squid-proxy ~]# systemctl enable --now squid.service Created symlink /etc/systemd/system/multi-user.target.wants/squid.service → /usr/lib/systemd/system/squid.service. [root@squid-proxy ~]# systemctl status squid.service ● squid.service - Squid caching proxy Loaded: loaded (/usr/lib/systemd/system/squid.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2020-12-17 23:17:24 CST; 8s ago Docs: man:squid(8) Process: 3894564 ExecStart=/usr/sbin/squid $SQUID_OPTS -f $SQUID_CONF (code=exited, statu> Process: 3894559 ExecStartPre=/usr/libexec/squid/cache_swap.sh (code=exited, status=0/SUC> Main PID: 3894566 (squid) Tasks: 3 (limit: 23840) Memory: 14.2M CGroup: /system.slice/squid.service ├─3894566 /usr/sbin/squid -f /etc/squid/squid.conf ├─3894573 (squid-1) --kid squid-1 -f /etc/squid/squid.conf └─3894582 (logfile-daemon) /var/log/squid/access.log Dec 17 23:17:24 squid-proxy.lianglab.cn systemd[1]: Starting Squid caching proxy... [root@squid-proxy ~]# netstat -antpl| grep squid tcp6 0 0 :::3128 ::