Thursday, October 28, 2010

Install Proxy di Ubuntu dengan Squid 2.7- Stables9

Form Opik + RH354

cara pertama yg gak mau repot[/i]
sebenernya paket2 deb (=untuk debian dan turunan) sudah ada di...
- untuk procie AMD64 / intel x64

http://packages.debian.org/sid/amd64/squid/download
- untuk procie Intel x86

http://packages.debian.org/sid/i386/squid/download
- untuk procie Intel ia64

http://packages.debian.org/sid/i386/squid/download
download file *.deb dan install dengan dpkg


cara kedua yg mau compile sendiri

1. Login ke server dengan root...

2. Sebelum melakukan compile, harus diketahui diperlukan repro lainnya untuk

menjalankan compile tersebut semisal gcc yang paling penting...

Code:
apt-get install gcc build-essential


3. download file source-code-nya di http://www.squid-cache.org/Versions/v2/2.7

disana ada 2 versi untuk stables9, keluaran 17 Maret 2010 versi yg sudah stabil dan

versi source-code terbaru tanggal 14 agustus 2010...


tetapi kita pilih versi 17 maret 2010 aja...

Code:
wget http://www.squid-cache.org/Versions/v2/2.7/squid-2.7.STABLE9.tar.bz2


4. kemudia ekstrak dan masuk ke folder hasil ekstrak...

Code:
tar xvf squid-2.7.STABLE9.tar.bz2 && cd squid-2.7.STABLE9


5. Lakukan configuration sebelum melakukan compile...

A. Tentukan dan pastikan hardware processor yang anda pakai untuk menentukan

nilai variable CHOST dan CFLAGS


Cara check processor bisa gunakan perintah ini...

Code:
cat /proc/cpuinfo


. kemudian cari spekfikasinya disini http://en.gentoo-wiki.com/wiki/Safe_Cflags/Intel dan

isi variable CHOST dan CFLAGS


punyaku
CHOST="i686-pc-linux-gnu" CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"



. Kemudian isi variable lainnya semisal peletakan posisi file, apa saja yang diaktifkan

dan bahasa yang dipilih, contoh...




./configure -prefix=/usr -exec-prefix=/usr -bindir=/usr/sbin -sbindir=/usr/sbin -libexecdir=/usr/lib/squid -sysconfdir=/etc/squid -localstatedir=/var/spool/squid -datadir=/usr/share/squid -enable-async-io -with-pthreads -enable-storeio=ufs,aufs,coss,diskd,null -enable-linux-netfilter -enable-arp-acl -enable-epoll -enable-removal-policies=lru,heap -enable-snmp -enable-delay-pools -enable-htcp -enable-cache-digests -enable-referer-log -enable-useragent-log -enable-auth=basic,digest,ntlm,negotiate -enable-negotiate-auth-helpers=squid_kerb_auth -enable-carp -enable-follow-x-forwarded-for -with-large-files -with-maxfd=65536 -enable-err-languages=English -enable-default-err-language=English


untuk variable lebih detail bisa ketik...

Code:
./configure --help


6. Lakukan compile...

Code:
make make install


7. Setting seperti biasa file /etc/squid/squid.conf cara2 selanjutnya seperti biasanya.

8. Untuk check versi squid...

Code:
squid -v
gedit /etc/init.d/squid



#! /bin/sh # # squid Startup script for the SQUID HTTP proxy-cache. # # Version: @(#)squid.rc 2.20 01-Oct-2001 miquels@cistron.nl # ### BEGIN INIT INFO # Provides: squid # Required-Start: $network $remote_fs $syslog # Required-Stop: $network $remote_fs $syslog # Should-Start: $named # Should-Stop: $named # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Squid HTTP Proxy ### END INIT INFO NAME=squid DAEMON=/usr/sbin/squid LIB=/usr/lib/squid PIDFILE=/var/spool/squid/logs/$NAME.pid SQUID_ARGS="-D -YC" [ ! -f /etc/default/squid ] || . /etc/default/squid . /lib/lsb/init-functions PATH=/bin:/usr/bin:/sbin:/usr/sbin [ -x $DAEMON ] || exit 0 grepconf () { w=" " # space tab sq=/etc/squid/squid.conf # sed is cool. res=`sed -ne ' s/^'$1'['"$w"']\+\([^'"$w"']\+\).*$/\1/p; t end; d; :end q' < $sq` [ -n "$res" ] || res=$2 echo "$res" } grepconf2 () { w=" " # space tab sq=/etc/squid/$NAME.conf # sed is cool. res=`sed -ne ' s/^'$1'['"$w"']\+[^'"$w"']\+['"$w"']\+\([^'"$w"']\+\).*$/\1/p; t end; d; :end q' < $sq` [ -n "$res" ] || res=$2 echo "$res" } # # Try to increase the # of filedescriptors we can open. # maxfds () { [ -n "$SQUID_MAXFD" ] || return [ -f /proc/sys/fs/file-max ] || return 0 global_file_max=`cat /proc/sys/fs/file-max` minimal_file_max=$(($SQUID_MAXFD + 4096)) if [ "$global_file_max" -lt $minimal_file_max ] then echo $minimal_file_max > /proc/sys/fs/file-max fi ulimit -n $SQUID_MAXFD } start () { cdr=`grepconf2 cache_dir /var/spool/$NAME` ctp=`grepconf cache_dir ufs` case "$cdr" in [0-9]*) log_failure_msg "squid: squid.conf contains 2.2.5 syntax - not starting!" log_end_msg 1 exit 1 ;; esac # # Create spool dirs if they don't exist. # if [ -d "$cdr" -a ! -d "$cdr/00" ] || [ "$ctp" = "coss" -a ! -w "$cdr" ] then log_warning_msg "Creating squid cache structure" $DAEMON $SQUID_ARGS -z fi if [ "$CHUID" = "" ]; then CHUID=root fi maxfds umask 027 start-stop-daemon --quiet --start \ --pidfile $PIDFILE \ --chuid $CHUID \ --exec $DAEMON -- $SQUID_ARGS < /dev/null return $? } stop () { PID=`cat $PIDFILE 2>/dev/null` start-stop-daemon --stop --quiet --pidfile $PIDFILE --name squid # # Now we have to wait until squid has _really_ stopped. # sleep 2 if test -n "$PID" && kill -0 $PID 2>/dev/null then log_action_begin_msg " Waiting" cnt=0 while kill -0 $PID 2>/dev/null do cnt=`expr $cnt + 1` if [ $cnt -gt 24 ] then log_action_end_msg 1 return 1 fi sleep 5 log_action_cont_msg "" done log_action_end_msg 0 return 0 else return 0 fi } case "$1" in start) log_daemon_msg "Starting Squid HTTP proxy" "squid" if start ; then log_end_msg $? else log_end_msg $? fi ;; stop) log_daemon_msg "Stopping Squid HTTP proxy" "squid" if stop ; then log_end_msg $? else log_end_msg $? fi ;; reload|force-reload) log_action_msg "Reloading Squid configuration files" $DAEMON -k reconfigure log_action_end_msg 0 ;; restart) log_daemon_msg "Restarting Squid HTTP proxy" "squid" stop if start ; then log_end_msg $? else log_end_msg $? fi ;; status) status_of_proc -p "$PIDFILE" "$DAEMON" squid && exit 0 || exit $? ;; *) echo "Usage: /etc/init.d/$NAME {start|stop|reload|force-reload|restart|status}" exit 3 ;; esac exit 0



save sebagai file squid di /etc/init.d lalu di chmod agar bisa di eksekusi


sudo chmod +x /etc/init.d/squid


jangan lupa di change owner tuk partisi squid sudo chown -R proxy:proxy /media/Proxy cek konfigurasi squid sudo squid -k parse kalo ga’ ada error silahkan dilanjutkan..Build cache dengan mengetikkan


sudo squid -z


restart squidnya sudo /etc/init.d/squid restart

No comments: