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:~ #
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...
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
squidGuard-1.3-57.63
squid3-3.0.STABLE10-2.11
yast2-squid-2.17.5-1.11
opensuse:~ #
squidGuard-1.3-57.63
squid3-3.0.STABLE10-2.11
yast2-squid-2.17.5-1.11
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 127.0.0.1/32
<snip> 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
<snip>
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:~ #
No comments:
Post a Comment