Tuesday, June 26, 2007

Squid Installation Notes (author - praban)

Squid Installation steps

1. make squid user/group

# groupadd -g 23 squid
# useradd -M -u 23 -g 23 -d /no/dir -s /bin/false squid

2. Use reiserfs for cache directory and add in fstab

/dev/hda6 /cache reiserfs notail,noatime 0 0

3. Configure

# CFLAGS="-O3 -march=i686" \
./configure \
--prefix=/opt/squid \
--disable-carp \
--enable-async-io=32 \
--with-aufs-threads=32 \
--enable-storeio=aufs \
--enable-removal-policies="heap" \
--enable-delay-pools \
--disable-wccp \
--disable-wccpv2 \
--enable-snmp \
--enable-arp-acl \
--enable-cache-digests \
--enable-err-language=English \
--enable-poll \
--enable-linux-netfilter \
--disable-ident-lookups \
--disable-unlinkd \
--enable-truncate \
--enable-pthreads \
--with-aio \
--with-dl

4. Compile & Install

# make
# make install
# strip /opt/squid/sbin/squid
# strip /opt/squid/bin/squidclient
# strip /opt/squid/libexec/*
# install /opt/squid/libexec/cachemgr.cgi /var/www/cgi-bin/
# mkdir -p /var/log/squid
# chown squid:squid /var/log/squid
# chown squid:squid /cache

5. squid.conf

http_port 3128
icp_port 0
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
cache deny QUERY
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
cache_mem 32 MB
cache_swap_low 90
cache_swap_high 95
maximum_object_size 10 MB
maximum_object_size_in_memory 8 KB
ipcache_size 2048
ipcache_low 90
ipcache_high 95
cache_replacement_policy heap LFUDA
memory_replacement_policy heap GDSF
cache_dir aufs /cache 6000 16 256
access_log /var/log/squid/access.log squid
cache_log /var/log/squid/cache.log
cache_store_log none
pid_filename /var/run/squid.pid
ftp_user netuser@
check_hostnames off
allow_underscore on
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
half_closed_clients off
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
acl ournet src 192.168.1.0/24
http_access allow ournet
http_access deny all
http_reply_access allow all
icp_access allow all
cache_mgr praban@hostingku.org
cache_effective_user squid
cache_effective_group squid
httpd_suppress_version_string on
visible_hostname hostingku.org
logfile_rotate 5
memory_pools off
via off
forwarded_for off
log_icp_queries off
cachemgr_passwd passwordku all
delay_pools 1
delay_class 1 2
delay_access 1 allow ournet
delay_access 1 deny all
delay_parameters 1 64000/64000 5000/16000

6. Ready to running

# /opt/squid/sbin/squid -z
# /opt/squid/sbin/squid -D

Shell's Command

I still learn about linux. This some of command that I know in linux's shell.
ls - listing
cd - change directory
mkdir - make directory
rmdir - remove directory
chmod - change permission mode TypeOfFile-owner-groups-others (ex: drwxr_xr_x)
chfn - change finger
usermod - change or add user attribute, for example: group
chown - change owner of file or directory
lspci - listing pci on pc
lsmod - listing module
ln - make link to a file or folder
cp - copy
mv - move or rename file
cat - concatenate files and print on the standard output
less - opposite of more
more - file perusal filter for crt viewing
grep
find
arp
ifconfig
iptables
ipchain
vmstat
etc...

So many syntax, Maybe u can find the rest. :)
You can see the manual by type "man <command>" or only need help just type "<command> -h" or "<command> --help ".

If u have question, u could ask by comment. I'll answer it if i could. So, we could learn together.
:D