This post gives the steps to quickly setup Squid proxy and make it up and caching in minutes. There are also some tips & tricks on squid. My squid proxy server runs on OpenSuSE 11.1.

opensuse:~ # cat /etc/SuSE-release
openSUSE 11.1 (i586)
VERSION = 11.1
opensuse:~ #

To download “squid” packages on opensuse, use zypper. The Zypper is a package/patch management tool in Suse, which works similar to yum.

opensuse:~ # zypper install squid3 squidGuard yast2-squid
Loading repository data…
Reading installed packages…
Resolving package dependencies…
The following NEW packages are going to be installed:
  libboost_regex1_36_0 squid3 squidGuard yast2-squid

Check the installed Squid rpms.
opensuse:~ # rpm -qa | grep squid
opensuse:~ #

The default squid configuration file is /etc/squid/squid.conf. The below configuration shows my setup, where I have changed the proxy port number & the cache directory. Make sure you have the cache directory created with the owner as squid.

opensuse:~ # grep -v ^# /etc/squid/squid.conf | grep -v ^$
acl manager proto cache_object
acl localhost src
http_port 8080 hierarchy_stoplist cgi-bin ?
cache_dir ufs /home/cache/squid 200 16 256 access_log /var/log/squid/access.log squid
coredump_dir /var/cache/squid
opensuse:~ #

Start Squid service using the below command.
opensuse:~ # service squid start
Starting WWW-proxy squid                                         done
opensuse:~ #

Now set your client browsers to access internet thorough this proxy. (opensuse:8080). To check the squid detailed cache information, you can use the command “squidclient”, as described below

opensuse:~ # squidclient -p 8080 cache_object://localhost/info
Squid Object Cache: Version 3.0.STABLE10
Connection information for squid:
        Number of clients accessing cache:      1
        Number of HTTP requests received:       0
        Number of ICP messages received:        0
        Number of ICP messages sent:    0
        Number of queued ICP replies:   0
        Number of HTCP messages received:       0
        Number of HTCP messages sent:   0
        Request failure ratio:   0.00
        Average HTTP requests per minute since start:   -0.0
        Average ICP messages per minute since start:    -0.0
        Select loop called: 23738 times, -143987.578 ms avg

opensuse:~ # squidclient -p 8080 cache_object://localhost/info | grep -A10 ^Cache
Cache information for squid:
        Hits as % of all requests:      5min: 0.0%, 60min: 0.0%
        Hits as % of bytes sent:        5min: -0.0%, 60min: -0.0%
        Memory hits as % of hit requests:       5min: 0.0%, 60min: 0.0%
        Disk hits as % of hit requests: 5min: 0.0%, 60min: 0.0%
        Storage Swap size:      6324 KB
        Storage Swap capacity:   3.1% used, 96.9% free
        Storage Mem size:       116 KB
        Storage Mem capacity:    1.4% used, 98.6% free
        Mean Object Size:       14.85 KB
        Requests given to unlinkd:      0
opensuse:~ #

Some more very useful squid tips at :
Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like
Read More

Disk information using smartctl

/usr/sbin/smartctl – controls  the  Self-Monitoring, Analysis and Reporting Technology (SMART) system built into many ATA-3 and later ATA,…
Read More

Few /proc files

/proc/cmdline – file has the parameters passed to the kernel while the system boots-up. /proc/kcore – This file…