checkout what is the latest version: ftp://ftp.cuhk.edu.hk/pub/packages/info-systems/www/squid/

probably this is more recent: https://github.com/squid-cache/squid

you could also try

git clone https://github.com/squid-cache/squid.git

and compile with the git source tree… let me know if it worked.

hostnamectl; # tested on
[root@CentosMaster squid-4.0.21]# hostnamectl
   Static hostname: CentosMaster
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-514.26.2.el7.x86_64
      Architecture: x86-64

su; # become root
mkdir /usr/src/squid
cd /usr/src/squid
wget ftp://ftp.cuhk.edu.hk/pub/packages/info-systems/www/squid/squid-4.0.21.tar.gz
tar fxvz squid-4.0.21.tar.gz
cd squid-4.0.21
yum install -y binutils gcc-c++
yum install -y perl gcc autoconf automake make sudo wget
yum install -y libxml2-devel libcap-devel
yum install -y libtool-ltdl-devel
./configure --prefix=/usr --includedir=/usr/include --datadir=/usr/share --bindir=/usr/sbin --libexecdir=/usr/lib/squid --localstatedir=/var --sysconfdir=/etc/squid
make clean
make -j4
make install

squid -v; # what version do we have got by all this effort?
Squid Cache: Version 4.0.21
Service Name: squid
configure options: '--prefix=/usr' '--includedir=/usr/include' '--datadir=/usr/share' '--bindir=/usr/sbin' '--libexecdir=/usr/lib/squid' '--localstatedir=/var' '--sysconfdir=/etc/squid'

that was the setup process for latest squid sources.

startup:

find / -name squid.conf; # find main squid config file
vim /etc/squid/squid.conf; # here it is

which squid; # where is the binary?
find / -name "*squid*"|grep bin; # alternatively

# create files for squid's default user nobody (otherwise it will complain "permission denied")
chown -R nobody:nobody /var/cache/squid

touch /var/logs/cache.log
chown nobody:nobody /var/logs/cache.log

touch /var/logs/access.log
chown -R nobody:nobody /var/logs/access.log

tail -f /var/logs/cache.log &

/usr/sbin/squid -z; #  Create missing swap directories and other missing cache_dir structures, then exit. 

/usr/sbin/squid; # try to start squid, watch errors

ps uax|grep squid; # test if it's running

# add firewall rule to allow squid proxy inbound connections
firewall-cmd --zone=public --add-port=3128/tcp --permanent
firewall-cmd --reload

tail /var/logs/cache.log
2017/08/01 06:14:19 kid1| Max Mem size: 262144 KB
2017/08/01 06:14:19 kid1| Max Swap size: 0 KB
2017/08/01 06:14:19 kid1| Using Least Load store dir selection
2017/08/01 06:14:19 kid1| Set Current Directory to /var/cache/squid
2017/08/01 06:14:19 kid1| Finished loading MIME types and icons.
2017/08/01 06:14:19 kid1| HTCP Disabled.
2017/08/01 06:14:19 kid1| Squid plugin modules loaded: 0
2017/08/01 06:14:19 kid1| Adaptation support is off.
2017/08/01 06:14:19 kid1| Accepting HTTP Socket connections at local=[::]:3128 remote=[::] FD 11 flags=9
2017/08/01 06:14:20 kid1| storeLateRelease: released 0 objects

sounds like a success…

testing:

squidclient – A simple HTTP web client tool, that come swith squid.

squidclient http://www.lpi.org

# watch squid at work
tail -f /var/logs/access.log & 

disk caching:

it seems like squid is doing RAM caching only per default.

to enable the disk caching … you go:

vim /etc/squid/squid.conf

# Uncomment and adjust the following to add a disk cache directory.
cache_dir ufs /var/cache/squid 1024 32 512
# 1024 = disk cache size in MBytes

Usage:
cache_dir ufs Directory-Name Mbytes L1 L2 [options]

‚Mbytes‘ is the amount of disk space (MB) to use under this
directory. The default is 100 MB. Change this to suit your
configuration. Do NOT put the size of your disk drive here.
Instead, if you want Squid to use the entire disk drive,
subtract 20% and use that value.

‚L1‘ is the number of first-level subdirectories which
will be created under the ‚Directory‘. The default is 16.

‚L2‘ is the number of second-level subdirectories which
will be created under each first-level directory. The default
is 256.

# how much RAM should be used for squid caching
cache_mem 512 MB

squid -k shutdown; # gracefully stop squid, waits 30 seconds for connections to close

mkdir /var/cache/squid/00
mkdir /var/cache/squid/01
chown -R nobody:nobody /var/cache/squid/

squid -z; # recreate disk caching dirs?

squid; # start squid again

it (should) create a structure like this:

ll /var/cache/squid/
total 196
drwxr-xr-x. 258 nobody nobody 8192 Aug  1 09:23 00
drwxr-x---. 258 nobody nobody 8192 Aug  1 09:23 01
drwxr-x---. 258 nobody nobody 8192 Aug  1 09:23 02
drwxr-x---. 258 nobody nobody 8192 Aug  1 09:23 03
drwxr-x---. 258 nobody nobody 8192 Aug  1 09:23 04
drwxr-x---. 258 nobody nobody 8192 Aug  1 09:23 05
drwxr-x---. 258 nobody nobody 8192 Aug  1 09:23 06
drwxr-x---. 258 nobody nobody 8192 Aug  1 09:23 07
drwxr-x---. 258 nobody nobody 8192 Aug  1 09:23 08
drwxr-x---. 258 nobody nobody 8192 Aug  1 09:23 09
drwxr-x---. 258 nobody nobody 8192 Aug  1 09:23 0A
drwxr-x---. 258 nobody nobody 8192 Aug  1 09:23 0B
drwxr-x---. 258 nobody nobody 8192 Aug  1 09:23 0C
drwxr-x---. 258 nobody nobody 8192 Aug  1 09:23 0D
drwxr-x---. 258 nobody nobody 8192 Aug  1 09:23 0E
drwxr-x---. 258 nobody nobody 8192 Aug  1 09:23 0F
-rw-r-----.   1 nobody nobody  648 Aug  1 09:24 swap.state


du -a /var/cache/squid/ | sort -n -r | head -n 30; # find largest cache dir
2008    /var/cache/squid/
1816    /var/cache/squid/00
1804    /var/cache/squid/00/00
364     /var/cache/squid/00/00/00000001
132     /var/cache/squid/00/00/00000020
108     /var/cache/squid/00/00/00000040
100     /var/cache/squid/00/00/00000000
76      /var/cache/squid/00/00/0000007A
76      /var/cache/squid/00/00/00000076
56      /var/cache/squid/00/00/00000050
56      /var/cache/squid/00/00/0000003F
52      /var/cache/squid/00/00/00000051
40      /var/cache/squid/00/00/00000011
36      /var/cache/squid/00/00/00000062
36      /var/cache/squid/00/00/0000004C
32      /var/cache/squid/00/00/00000043
32      /var/cache/squid/00/00/00000030
16      /var/cache/squid/00/00/0000004F
16      /var/cache/squid/00/00/0000004E
16      /var/cache/squid/00/00/00000037
16      /var/cache/squid/00/00/0000002C
16      /var/cache/squid/00/00/0000001A
12      /var/cache/squid/swap.state
12      /var/cache/squid/0F
12      /var/cache/squid/0E
12      /var/cache/squid/0D
12      /var/cache/squid/0C
12      /var/cache/squid/0B
12      /var/cache/squid/0A
12      /var/cache/squid/09


manpages:

squidclient.man.txt

squid.man.txt

Reverse proxy?

if you want a reverse-proxy to accelerate web traffic by caching images and slow-generating pages, you might want to look at Varnish instead of Squid. It’s designed for reverse-proxy behavior, is lightning fast, and fairly simple to set up. Squid is designed as a forward proxy more than a reverse proxy. If you had a large social network site, you might want to consider using a CDN for the images and static content as well. Internet -> CDN -> Varnish -> Apache cluster You can also use Varnish as a load balancer as it can check node health.

src: https://serverfault.com/questions/66516/why-would-i-use-squid

Links:

http://wiki.squid-cache.org/SquidFaq/CompilingSquid


http://wiki.squid-cache.org/FrontPage

admin