Detailed configuration tutorial for installing the Squid agent under linux

  • 2020-05-07 20:40:07
  • OfStack

1. If squid is not installed in the system, the installation can be completed after entering the following commands
# wget http: / / www squid - cache. org Versions/v3/3.0 / squid - 3.0 STABLE18. tar. gz / / download Squid agent installation package
# tar - zxvf squid 3.0. STABLE18. tar. gz / / decompression Squid installation package
# cd squid-3.0.STABLE18
#. / configure - prefix = / usr/local squid sysconfdir = / usr/local/squid/etc - bindir = / usr/local/squid/bin - sbindir = / usr/local/squid/sbin - mandir = / usr/local/squid/share/man -- enable-carp -- enable-carp -- enable-async-io =80 -- enable-removal-policies =heap,lru -- enable-icmp -- enable-delay-pools -- enable-useragent-log -- enable-referer-log -- enable-kill-parent-hack -- enable-snmp -- enable-arp-Versionsen-digests -- enable-enable-digests -- enable-err-digests ="Simplify_Chinese" -- enable-poll -- enable-linux-netfilter -- disable-squid-lookups -- enable-underscores -- enable-auth ="basic" -- enable-basic-auth-helpers ="NCSA" -- enable-external-acl-helpers ="ip_user" -- enable-tar-accelerator-vary // configure the Squid agent installation path and so on
# make // compile
make install // install Squid agent software

----------------------------------

2. Installed configuration file in/usr local/squid/etc directory, delete the original squid. conf configuration file, new squid. conf files, just enter the following:
http_port 80 transparent
http_access allow all

Note that the above is the configuration of squid2.6 and later. If it is squid before 2.6, the configuration is as follows:
http_port 80
httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on

----------------------------------

3. / usr local squid/sbin squid for running files in the directory.
On the first run, run squid-z to create the cache folder. Cache folder under/usr local/squid/var created, so still need to run before creating the cache chmod 777 / usr/local squid/var permissions to the folder.
Then run squid-d 1 and turn on squid.
If you want to close squid, running squid-k shutdown is a safe shutdown.
Note that if you have not configured the newly installed squid as an environment variable, try to run it in the sbin directory./squid to avoid running the old squid already on the server.

----------------------------------

4. Set up one DNS server, and point all domain name resolution to IP of the server that needs to be proxy, for example, using Bind, WinMyDns software. Set DNS of the server where squid resides to the DNS server.

5. Resolve all domain names of the proxy server to the server where squid is located, and the server can act as a transit.

----------------------------------

Possible questions:
Squid sometimes runs with errors:
clientNatLookup: NF getsockopt(SO_ORIGINAL_DST) failed: (92) Protocol not available
But access does not seem to be affected

Related articles: