Saturday 8 October 2011

INSTALL PROXY SQUID DI LINUX UBUNTU

INSTALL PROXY SQUID DI LINUX UBUNTU
1. masukan terminal ketik sudo su (enter) masukan password
2. ketik sudo apt-get install squid (enter) tunggu sampai proses install selesai (komputer harus terhubung ke internet)
3. Selanjutnya setting di config squid, sebelumnya backup dulu file asli squid.conf dgn cara ketikkan di terminal
code:
sudo cp /etc/squid/squid.conf
/etc/squid/squid.conf.original
setelah itu buka /edit file squid.conf seperti dibawah ini dgn cara ketikkan
Code:
sudo gedit /etc/squid/squid.conf
isi seperti di bawah ini:
auth_param basic program /usr/lib/squid/ncsa_auth
/etc/squid.passwd
auth_param basic children 5
auth-param basic realm NFYE Squid proxy-caching web
server
auth_param basic credentialsttl 3 hours
auth_param basic casesensitive off
acl user proxy_auth REQUIRED
acl sectionx proxy_auth REQUIRED
http_access allow users
acl all src 0.0.0.0/0.0.0.0
acl internal_network src 192.168.0.0/24
acl users proxy_auth    REQUIRED
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 443563 # https,snews
acl SSL_ports port 873 # rsync
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 563 # https,snews
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 # gas-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl Safe_ports port 631 # cups
acl Safe_ports port 873 # rsync
acl Safe_ports port 901 # SWAT
acl sectionx proxy_auth REQUIRED
acl purge method PURGE
acl CONNECT method CONNECT
http_access allow manager localhost
http_access allow users
http_access allow internal_network
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access deny CONNECTISSL_ports
http_access allow localhost
http_access deny all
http_reply_access allow all
icp_access allow all
http_port 3128 transparent
visible_hostname stbserver
hierarchy_stoplist cgi-bin ?
cache_dir ufs /usr/local/squid/cache 102416256
access_log/usr/local/squid/access.log
cache_log/usr/local/squid/cache.log
cache_store_log none
cache_mem 1024 MB
cache_swap_low 94
cache_swap_high 96
maximum_object_size 16384 KB
minimum_object_size 4 KB
maximum_object_size_in_memory 2048 KB
fqdncache_size 1024
cache_replacement_policy heap GDSF
memory_replacement_policy heap GDSF
acl QUERY urlpatch_regex cgi-bin \?
cache deny QUERY
refresh_pattern ^ftp:    1440 20% 10080
refresh_pattern ^gopher: 14440 0% 1440
refresh_pattern. 0 20% 4320
acl apache rep_header Server ^ Apache
broken_vary_encoding allow apache
extension_methods REPORT MERGE MKACTIVITY
CHECKOUT
host_file /etc/hosts
coredumb_dir/var/spool/squid
cache_mgr udin_law@yahoo.co.id
cache_effective_user squid
cache_effective_groub squid
4.Membuat file log dan direktory untuk cache
membuat direktory squid
$ mkdir /usr/local/squid
Membuat direktory cache
$ mkdir /usr/local/squid/cache
Membuat file cache log yg berfungsi untuk melihat dan memonitoring aktifitas yang sedang dilakukan client
$touch /usr/local/squid/cache.log
Membuat file access log berfungsi untuk memonitoring aktifitas yang dilakukan oleh cache server
$touch /usr/local/squid/access.log
Membuat user dan group squid sebagai pemilik dari proses squid dan loginnya,ini dibuat dengan  alasan keamanan jika
sistem squid diserang cracker dan bisa di akses oleh cracker bukan root yang diambil alih
$sudo adduser squid
Memberikan attribut dan hak milik aras direktori squid beserta sub sub direktoro + file-file yang ada di dalamnya
$chown -Rf squid.squid/usr/local/squid
$sudo chown squid.squid /var/spool/squid -Rf
$ sudo chown squid.squid -Rf/etc/squid
5. Membuat struktur cache derectory
root@ubuntu:/home/stb# squid -z
2009/12/22 21:45:46| Squid is already running! Process ID 2608
root@ubuntu:/home/stb#
6.Test squid
root@ubuntu:home/stb# squid -d1 -D
2009/12/22 21:46:42| Squid is already running! Process
ID 2608
root@ubuntu:/home/stb#
7.root@ubuntu:/home/stb# tail -f
/usr/local/squid/access.log
1261532379.994 761 192.168.0.105 TCP_MISS/200
4539 GET
http://en-us.www.mozilla.com/img/tignish/template
/background-tile.png grosir DIRECT/63.245.209.10
image/png
1261532380.042 540 192.168.0.105 TCP_MISS/200
1437 GET
http://en-
us.www.mozilla.com/img/tignish/template/mozilla-logo.png
grosir DIRECT/62.245.209.10 image/png
1261532380.450 884 192.168.0.105 TCP_MISS/200 1011
GET
http://en-
us.www.mozilla.com/img/tignish/template/header-
background.png grosir DIRECT/63.245.209.10 image/png
1261532380.594 1005 192.168.0.105 TCP_MISS/200 936
GET
http://en-
us.www.mozilla.com/img/tignish/whatnews/sub-feature-
top.png grosir DIRECT/63.245.209.10 image/png
1261532380.707 1117 192.168.0.105 TCP_MISS/200 784
GET
http://en-us.www.mozilla.com/img/tignish/firsturn/link-
arrow.png grosir DIRECT/63.245.209.10 image/png
1261532381.079 1086 192.168.0.105 TCP_MISS/200 2073
GET
http://en-us.www.mozilla.com/img/tignish/template/footer-logo.png
grosir DIRECT/63.245.209.10 image/png
1261532381.210 1167 192.168.0.105 TCP_MISS/200 568
GET
http://en-
us.www.mozilla.com/img/_utm.gif?utmwv=6.1&utmn=51
5583513utmsr=800×600&utmsc=32-bit&utmul=en-
us&utmje=0&utmjv=1.5&utmfl=-
&utmdt=Firefox%20Updated&utmhn=en-
us.www.mozilla.com&utmr=-&utmp=/en-
US/firefox/3.5.6/whatnews/grosir
DIRECT/63.245.209.10 image/gif
1261532381.310 1745 19.168.0.105
TCP_REFRESH_MISS/200 6383 GET
http://en-
-us.www.mozilla.com/img/tignish/whatnews/sub-feature-
bottom.png grosir DIRECT/63.245.209.10 image/png
1261532381.545 2000 192.168.0.105
TCP_REFRESH_MISS/200 4931 GET
http:/en-
us.www.mozilla.com/image.tignish/whatnews/3.5.background.jpg
grosir DIRECT/63.245.209.10 image/jpeg
1261532381.598 2007 192.168.0.105
TCP_REFRESH_MISS/200 4241 GET
http://en-
us.www.mozilla.com/img/tignish/template/footer-portal-
border.png grosir DIRECT/63.245.209.10 image/png
8.Memberikan hak akses(permission)tiap-tiap user sebelumnya install dulu apache 2
ketik kode:
apt-get install apache2
setelah selesai selanjutnya bikin firs user yang bisa meng akses proxy:
masih di terminal ketikkan : sudo htpasswd -c
/etc/squid.passwd user1———–user1 bisa diganti dengan apa saja
root@ubuntu:/home/stb# sudo htpasswd -c
/etc/squid.passwd user1
new password:
re-type new password:
adding password for user user1
root@ubuntu:/home/stb#
berikutnya bikin user bar, masih di terminal ketikkan: sudo htpasswd/etc/squid.passwd client1
root@ubuntu:/home/stb# sudo htpasswd
/etc/squid.passwd client1
new password:
re-type newpassword:
adding password for user client1
root@ubuntu:/home/stb#
Restart squid anda
code:
sudo /etc/init.d/squid restart
test squid anda, sebelum setting proxy di browser:
addres:ip squid port:3128