linux

linux

Selasa, 06 Maret 2012

install squid 3.1.19 at slackware 13.37

bellow resume for install squid 3.1.19 at slackware 13.37

download from http://www.squid-cache.org/Versions/v3/3.1/
#tar -xvf squid-3.1.19.tar.gz

#./configure
#make all
#make install
#groupadd proxy
#useradd proxy -g proxy -d /usr/local/squid -s /usr/bin/nologin
#mkdir /cache
#chown -R proxy.proxy /cache
# scp 192.168.1.191:/sdb/Docu/gudang/malang/squid.conf /usr/local/squid/etc/
you can create your own squid.conf  see the create squid.conf
#scp 192.168.1.191:/root/gudang/rc.squid /etc/rc.d/
 or create rc.squid bellow
#chown -R proxy.proxy /cache
#chmod a+w /cache
#useradd squid
#/usr/local/squid/sbin/squid -z
#cd /usr/local/squid/var/
#chmod -R a+w logs     
#cd logs
#chown squid cache.log
#/etc/rc.d/rc.squid start
#ps -ax | grep squid

create  rc.squid

#cd /etc/rc.d/
#nano rc.squid
copy this text at your rc.squid :
----------------------------------------------------------------------------------------------------------
#!/bin/sh
# Start/stop/restart/reload the Squid Internet Object Cache (squid)
# To make Squid start automatically at boot, make this
# file executable:  chmod 755 /etc/rc.d/rc.Squid
#
# Written for Slackware Linux by Erik Jan Tromp
# Modified by David Somero <xgizzmo@slackbuilds.org>

SQUIDCFG=/usr/local/squid/etc/squid.conf
SQUIDCMD=/usr/local/squid/sbin/squid

if [ ! -r $SQUIDCFG ]; then
  echo "Please set the correct path to $SQUIDCFG"
  exit 1
fi

if [ ! -x $SQUIDCMD ]; then
  echo "$SQUIDCMD not found"
  exit 1
fi

squid_start() {
  # Create cache directory hierarchy if needed
  ALL_DIRS=$(awk '/^cache_dir/ {print $3}' $SQUIDCFG)
  [ -z "$ALL_DIRS" ] && ALL_DIRS=/var/cache/squid

  for CACHE_DIR in $ALL_DIRS ; do
    if [ ! -d $CACHE_DIR/00 ] ; then
      echo "Creating swap directories:  $SQUIDCMD -z"
      $SQUIDCMD -z 2> /dev/null
      break
    fi
  done

  echo "Starting Squid:  $SQUIDCMD -SDYCF"
  $SQUIDCMD -SDYCF
}
squid_stop() {
  COUNTDOWN=$(awk '/^shutdown_lifetime/ {print $2}' $SQUIDCFG)
  [ -z "$COUNTDOWN" ] && COUNTDOWN=5

  echo -n "Shutting down Squid in $COUNTDOWN seconds:  "
  $SQUIDCMD -k shutdown 2> /dev/null
  while $SQUIDCMD -k check 2> /dev/null ; do
    sleep 1
    echo -n .
    COUNTDOWN=$[ $COUNTDOWN - 1 ]
    if [ $COUNTDOWN -le 0 ] ; then
      $SQUIDCMD -k interrupt 2> /dev/null
      sleep 1
      break
    fi
  done
  echo
}
squid_restart() {
  squid_stop
  sleep 1
  squid_start
}

squid_reload() {
  $SQUIDCMD -k reconfigure 2> /dev/null
}

case "$1" in
'start')
  squid_start
  ;;
'stop')
  squid_stop
  ;;
'restart')
  squid_restart
  ;;
'reload')
  squid_reload
  ;;
*)
  echo "usage: $0 start|stop|restart|reload"
esac
-----------------------------------------------------------------------------------------------------
#chmod a+x rc.squid
for start up squid at boot server linux
add this line at /etc/rc.d/rc.local
"/etc/rc.d/rc.squid start"
#nano /etc/rc.d/rc.local

/etc/rc.d/rc.squid start

to start your proxy
#/etc/rc.d/rc.squid start
to stop your proxy
#/etc/rc.d/rc.squid stop
to reload your proxy after reconfigure your squid.conf
#/etc/rc.d/rc.squid reload

===============================================
for any error see cache.log
#nano /usr/local/squid/var/logs/cache.log

this step working  at my proxy server
Happy ...Slackware..... :)




create your squid.conf

for simple way you can edit the squid.conf
 
#cd /usr/local/squid/etc/
#nano squid.conf
find text bellow
======================================
# should be allowed
#acl localnet src 10.0.0.0/8    # RFC1918 possible internal network
#acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
#acl localnet src 192.168.0.0/16        # RFC1918 possible internal network
-------------------------------------------------------------
add your acl at your network
-------------------------------------------------------------
acl localnet src 192.168.23.0/24
acl admin1 src 192.168.23.7/32
acl ipblock src 192.168.23.21/32
---------------------------------------------------------------
 find text : # INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
and add your acl site to block or allow
-----------------------------------------------------
acl company url_regex -i youtube.com
acl linux  url_regex -i linux.com

http_access allow admin1 all

http_access deny ipblock company
http_access allow ipblock linux

http_access deny localnet all

=============================================
this squid.conf mean :
allow admin1 to all internet
deny ipblock(192.168.23.21) to see youtube.com
allow ipblock to see linux.com

Tidak ada komentar:

Posting Komentar