Pages

Selasa, 20 Maret 2012

Instalasi Squid Di Windows XP



Penghematan bandwidth yang di kerjakan oleh squid merupakan salah satu solusi sewaktu kita memiliki resource koneksi yang terbatas. Bayangkan kita tidak perlu me”reload” content dari banyak web yang pernah kita kunjungi sebelumnya. Tentunya hal ini dapat menghemat waktu dalam berselancar ria di dunia maya.

Pada tutorial ini sebelumnya kita harus mendownload squid untuk pertama kalinya, beberapa versi squid dapat dilihat disini:

http://www.acmeconsulting.it/pagine/opensource/download/squid.htm

atau lebih ringkasnya langsung saja download versi Squid2.6 Stable18:

http://squid.acmeconsulting.it/download/squid-2.6.STABLE18-bin.zip

Hasil dari download akan berupa file zip, extract file tersebut ke C:, sehingga di drive C akan muncul direktori baru dengan nama “squid”.

Masuk ke direktori “c:squidetc”, kita akan menemukan 3 buah file dengan nama “cachemgr.conf.default”, “mime.conf.default” dan “squid.conf.default”. Salin ketiga file tersebut dan rubah namanya

“cachemgr.conf.default” menjadi ”cachemgr.conf”

“mime.conf.default” menjadi “mime.conf”, dan

“squid.conf.default” menjadi “squid.conf”

Setelah ketiga file diatas dirubah namanya, kita hanya akan edit satu file saja yaitu file “squid.conf”, buka file “squid.conf” menggunakan notepad atau wordpad.

* Gunakan find (Ctrl+F), ketik “TAG: http_port”, pastikan nilainya 3128. bisa juga dirubah ke nilai lain tapi untuk sekarang biarkan saja 3128. pastikan barisnya sama dengan “http_port 3128”, jangan lupa buang tanda “#”

# Squid normally listens to port 3128

http_port 3128

* Cari “TAG: visible_hostname”, kurang lebih isinya sebagai berikut

# TAG: visible_hostname

# If you want to present a special hostname in error messages, etc,

# define this. Otherwise, the return value of gethostname()

# will be used. If you have multiple caches in a cluster and

# get errors about IP-forwarding you must set them to have individual

# names with this setting.

#

#Default:

# none

tambahkan baris “visible_hostname localhost” dibawah “#none”, sehingga menjadi

# TAG: visible_hostname

# If you want to present a special hostname in error messages, etc,

# define this. Otherwise, the return value of gethostname()

# will be used. If you have multiple caches in a cluster and

# get errors about IP-forwarding you must set them to have individual

# names with this setting.

#

#Default:

# none

visible_hostname localhost

* Cari kata “our_networks”

#acl our_networks src 192.168.1.0/24 192.168.2.0/24

#http_access allow our_networks

di edit, dan hilangkan tand “#” dan sesuaikan dengan alamat jaringan anda ditambah dengan localhost, sehingga menjadi

acl our_networks src 192.168.1.0/24

http_access allow localhost

http_access allow our_networks

* Cari “TAG: dns_nameservers”

# TAG: dns_nameservers

# Use this if you want to specify a list of DNS name servers

# (IP addresses) to use instead of those given in your

# /etc/resolv.conf file.

# On Windows platforms, if no value is specified here or in

# the /etc/resolv.conf file, the list of DNS name servers are

# taken from the Windows registry, both static and dynamic DHCP

# configurations are supported.

#

# Example: dns_nameservers 10.0.0.1 192.172.0.4

#

#Default:

# none

Isikan baris dibawahnya dengan nama DNS ISP anda, untuk pelanggan dial-up, cara mengetahui alamat DNS ISP anda adalah, dengan mengetikkan “ipconfig /all” pada command prompt, setelah konek ke internet, dan cari entry DNS , biasanya ada dua alamat. Misalnya DNS ISP anda (Speedy) 202.134.1.10 dan 202.134.0.155, maka isikan baris sebagai berikut

# TAG: dns_nameservers

# Use this if you want to specify a list of DNS name servers

# (IP addresses) to use instead of those given in your

# /etc/resolv.conf file.

# On Windows platforms, if no value is specified here or in

# the /etc/resolv.conf file, the list of DNS name servers are

# taken from the Windows registry, both static and dynamic DHCP

# configurations are supported.

#

# Example: dns_nameservers 10.0.0.1 192.172.0.4

#

#Default:

# none

dns_nameservers 202.134.1.10 202.134.0.155

Simpan file squid.conf, buka command prompt. Untuk yang punya keyboard dengan logo windows, tekan logo windows sambil menekan huruf “R”, dan ketikkan “cmd”. Maka akan muncul command prompt, masuk ke direktori “C:squidsbin” dengan cara mengetikkan “cd C:squidsbin”, didalamnya ada file squid.exe, untuk pertama kali jalankan squid dengan option –z. Ketik:

>squid -z

Output:

2007/04/23 18:31:13| Creating Swap Directories

Command diatas berfungsi untuk inisialisasi cache squid, setelah itu ketikkan

>squid -d 1 -D

option “-d 1” digunakan untuk masuk ke debug level (untuk diagnosa saja) dan option “-D” digunakan untuk membypass pengecekan DNS, berguna jika anda belum terkoneksi ke internet. kalau sukses outputnya kurang lebih seperti ini :

2007/04/23 18:31:31| Starting Squid Cache version 2.6.STABLE18 for i686-pc-winnt

2007/04/23 18:31:31| Running on Windows XP

2007/04/23 18:31:31| Process ID 3616

2007/04/23 18:31:31| With 2048 file descriptors available

2007/04/23 18:31:31| With 512 CRT stdio descriptors available

2007/04/23 18:31:31| Windows sockets initialized

2007/04/23 18:31:31| Using select for the IO loop

2007/04/23 18:31:31| DNS Socket created at 0.0.0.0, port 1054, FD 4

2007/04/23 18:31:31| Adding nameserver 202.134.1.10 from squid.conf

2007/04/23 18:31:31| Adding nameserver 202.134.0.155 from squid.conf

2007/04/23 18:31:31| User-Agent logging is disabled.

2007/04/23 18:31:31| Referer logging is disabled.

2007/04/23 18:31:31| Unlinkd pipe opened on FD 7

2007/04/23 18:31:31| Swap maxSize 102400 KB, estimated 7876 objects

2007/04/23 18:31:31| Target number of buckets: 393

2007/04/23 18:31:31| Using 8192 Store buckets

2007/04/23 18:31:31| Max Mem size: 8192 KB

2007/04/23 18:31:31| Max Swap size: 102400 KB

2007/04/23 18:31:31| Local cache digest enabled; rebuild/rewrite every 3600/3600 sec

2007/04/23 18:31:31| Rebuilding storage in c:/squid/var/cache (DIRTY)

2007/04/23 18:31:31| Using Least Load store dir selection

2007/04/23 18:31:31| Set Current Directory to c:/squid/var/cache

2007/04/23 18:31:31| Loaded Icons.

2007/04/23 18:31:31| Accepting proxy HTTP connections at 0.0.0.0, port 3128, FD 12.

2007/04/23 18:31:31| Accepting ICP messages at 0.0.0.0, port 3130, FD 13.

2007/04/23 18:31:31| Accepting HTCP messages on port 4827, FD 14.

2007/04/23 18:31:31| Accepting SNMP messages on port 3401, FD 15.

2007/04/23 18:31:31| Ready to serve requests.

2007/04/23 18:31:31| Done scanning c:/squid/var/cache (0 entries)

2007/04/23 18:31:31| Finished rebuilding storage from disk.

2007/04/23 18:31:31| 0 Entries scanned

2007/04/23 18:31:31| 0 Invalid entries.

2007/04/23 18:31:31| 0 With invalid flags.

2007/04/23 18:31:31| 0 Objects loaded.

2007/04/23 18:31:31| 0 Objects expired.

2007/04/23 18:31:31| 0 Objects cancelled.

2007/04/23 18:31:31| 0 Duplicate URLs purged.

2007/04/23 18:31:31| 0 Swapfile clashes avoided.

2007/04/23 18:31:31| Took 0.6 seconds ( 0.0 objects/sec).

2007/04/23 18:31:31| Beginning Validation Procedure

2007/04/23 18:31:31| Completed Validation Procedure

2007/04/23 18:31:31| Validated 0 Entries

2007/04/23 18:31:31| store_swap_size = 0k

2007/04/23 18:31:32| storeLateRelease: released 0 objects

Tekan Ctrl+C

setelah yakin squid jalan, kita tinggal masukkan squid ke service windows dengan cara

>squid -i

Output :

Registry stored HKLMSOFTWAREGNUSquid2.6SquidConfigFile value c:/squid/etc/ squid.conf

Squid Cache version 2.6.STABLE12 for i686-pc-winnt

installed successfully as Squid Windows System Service.

To run, start it from the Services Applet of Control Panel.

Don’t forget to edit squid.conf before starting it.

Dan Lanjutkan dengan mengetikkan

>squid -O -D

Output :

Registry stored HKLMSOFTWAREGNUSquid2.6SquidCommandLine value -D

command diatas untuk memasukkan parameter -D ketika service dijalankan

Start service pertama kali, masuk ke control panel >> administrative tools >> services, cari service dengan nama “squid”, klik kanan > start.

Konfigurasi di client/PC tinggal masukkan saja alamat proxy (alamat dimana squid diinstall) dan portnya 3128.

Jangan lupa mematikan Windows Firewall, klik Start menu >> Settings >> Control Panel >> Windows Firewall >> di tab General pilih option Off >> OK, atau jika Anda ingin tetap menjalankan firewall maka biarkan firewall tetap On >> di tab Exeptions klik Add Port >> isikan kolom Name dengan squid dan Port Number dengan 3128, TCP >> OK.

Kemudian buka Web Browser:

· Untuk Mozilla Firefox 2.0 dst, klik Tools >> Options >> Advanced >> Network >> Setting >> pilih Manual proxy configuration: HTTP Proxy: localhost Port:3128, kemudian beri tanda check “√” pada Use this proxy server for all protocols, kosongkan kolom No proxy for: >> OK. Sebaiknya Firefox di set untuk tidak menyimpan content atau history browser, caranya klik Tools >> Options >> Privacy >> beri tanda check “√” pada Always clear my private data when I close Firefox, klik Settings…>> beri tanda check “√” pada semua check box yang ada>> OK, kemudian buang tanda check “√” pada Ask me before clearing private data >> OK.

untuk informasi lebih lanjut atau konfigurasi yang lebih lengkap silahkan buka alamat proxy squid di http://www.squid-cache.org

Selamat mencoba.

Untuk konfigurasi squid.conf yang saya gunakan silakan lihat di bawah ini:

==============

# WILKAM TANG SAKUIT ULAHAN IRGUNAWANSPK

# Untuk info lebih jelas bisa add id YM saya dibawah ini

# irgunawan_spk

http_port 3128

hierarchy_stoplist cgi-bin ?

acl QUERY urlpath_regex cgi-bin ?

cache deny QUERY

acl apache rep_header Server ^Apache

broken_vary_encoding allow apache

access_log c:/squid/var/logs/access.log squid

dns_nameservers 202.87.248.14 202.87.251.14

refresh_pattern ^ftp: 1440 20% 10080

refresh_pattern ^gopher: 1440 0% 1440

refresh_pattern -i .(class|css|js|gif|jpg)$ 10080 100% 43200 override-expire

refresh_pattern -i .(jpe|jpeg|png|bmp|tif)$ 10080 100% 43200 override-expire

refresh_pattern -i .(tiff|mov|avi|qt|mpeg)$ 10080 100% 43200 override-expire

refresh_pattern -i .(mpg|mpe|wav|au|mid)$ 10080 100% 43200 override-expire

refresh_pattern -i .(zip|gz|arj|lha|lzh)$ 10080 100% 43200 override-expire

refresh_pattern -i .(rar|tgz|tar|exe|bin)$ 10080 100% 43200 override-expire

refresh_pattern -i .(hqx|pdf|rtf|doc|swf)$ 10080 100% 43200 override-expire

refresh_pattern -i .(inc|cab|ad|txt|dll)$ 10080 100% 43200 override-expire

refresh_pattern -i .(asp|acgi|pl|shtml|php3|php)$ 2 20% 4320 reload-into-ims

refresh_pattern -i ? 2 20% 4320 reload-into-ims

refresh_pattern -i cgi-bin 2 20% 4320 reload-into-ims

refresh_pattern . 960 90% 43200 reload-into-ims

refresh_pattern -i .google.co.id$ 1440 100% 3500 override-expire override-lastmod reload-into-ims ignore-reload

refresh_pattern -i .co.id$ 1440 100% 3500 override-expire override-lastmod reload-into-ims ignore-reload

refresh_pattern -i .mail.yahoo$ 1440 100% 3500 override-expire override-lastmod reload-into-ims ignore-reload

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 localhost

http_access allow manager localhost

http_access deny manager

http_access deny !Safe_ports

http_access deny CONNECT !SSL_ports

http_access deny all

icp_access allow all

visible_hostname localhost

coredump_dir c:/squid/var/cache

# Habisssss

==============

0 komentar:

Posting Komentar