Installation Squid Proxy 2.6
Setelah males-malesan hampir satu bulan akhirnya ada niat juga buat ngisi blog lagi
.
Squid mungkin cuman satu dari sekian banyak proxy server yang ada tetapi saya yakin squid masih tetap yang paling banyak dipakai. Banyak alasan kenapa orang memakai squid sebagai proxy server diantaranya adalah:
1. Gratis, ya squid gak perlu lisensi macem-macem dan gak harus bayar.
2. Stabil, jarang sekali squid crash atau error kalo bener setting nya tentunya.
3. Cepat, dibanding aplikasi proxy yang lain squid lumayan cepat apalagi dibanding yang under windows.
4. Banyak fitur nya, Proxy mungkin banyak yang gratis mungkin banyak juga yang cepat juga banyak tapi yang fitur nya sebanyak squid sangat susah ditemukan.
OK cukup sudah cuap-cuap nya sekarang kita mulai install squid. Pada bagian ini saya akan mencoba menunjukan cara installasi squid di FreeBSD dan Linux. Biar post di kategori Linux nambah
.
INSTALLASI
FreeBSD
Semua dilakukan dengan account root.
1. cd /usr/ports/www/squid26
2. make config
3. make install clean
cd /usr/ports/www/squid26 make config make install clean
Pada make config di window configurasi silahkan anda pilih opsi berikut ini (gak harus) biar gak ribet nanti seterusnya:
* SQUID_DELAY_POOLS : untuk mengatur bandwidth
* SQUID_SNMP : kalo mau monitor traffic lewat mrtg
* SQUID_CACHE_DIGESTS : bikin enable cache digests
* SQUID_WCCP : web cache coordination Prot v1
* SQUID_IDENT : Ident lookup
* SQUID_USERAGENT_LOG : user agent header log
* SQUID_ARP_ACL : ACL berdasarkan mac address
* SQUID_PF : kalo mau bikin transparent proxy pake pf
* SQUID_IPFILTER : kalo mau bikin transparent proxy pake ipfilter
* SQUID_KQUEUE : enable kqueue
* SQUID_LARGEFILE : kalo cache dan log lebih dari 2Gb
LINUX
Dengan opsi yang hampir mirip dengan yang saya pakai di BSD kita coba install squid di Linux, jangan lupa cek squid release terakhir dari www.squid-cache.org atau klik link ini http://www.squid-cache.org/Versions/v2/2.6/
·········10········20········30········40········50········60········70········80········90········100·······110·······120·······130·······140·······150
1. w get http://www.squid-cache.org/Versions/v2/2.6/squid-2.6.STABLE5.tar.gz
2.
3. tar -zxvf squid-2.6.STABLE5.tar.gz
4. cd squid-2.6.STABLE5
5.
6. ./configure –bindir=/usr/local/sbin –sbindir=/usr/local/sbin –datadir=/usr/local/etc/squid –sysconfdir=/usr/local/etc/squid –enable-linux-netfilter –enable-delay-pools –enable-snmp –enable-cache-digests –enable-useragent-log –enable-arp-acl –with-large-files –enable-large-cache-files –enable-err-languages=English –enable-default-err-language=English –prefix=/usr/local/squid
7. make
8. make install
w get http://www.squid-cache.org/Versions/v2/2.6/squid-2.6.STABLE5.tar.gz tar -zxvf squid-2.6.STABLE5.tar.gz cd squid-2.6.STABLE5 ./configure –bindir=/usr/local/sbin –sbindir=/usr/local/sbin –datadir=/usr/local/etc/squid –sysconfdir=/usr/local/etc/squid –enable-linux-netfilter –enable-delay-pools –enable-snmp –enable-cache-digests –enable-useragent-log –enable-arp-acl –with-large-files –enable-large-cache-files –enable-err-languages=English –enable-default-err-language=English –prefix=/usr/local/squid make make install
Kemudian silahkan buat satu user bernama squid group squid dengan home /usr/local/squid dan shell /usr/bin/nologin
Kalau anda ngga suka dengan opsi-opsi diatas silahkan rubah.
KONFIGURASI
Untuk memulai configurasi squid silahkan edit file squid.conf atau anda bisa mempergunakan contoh squid.conf dibawah.
1. pico /usr/local/etc/squid/squid.conf
pico /usr/local/etc/squid/squid.conf
Apabila di shell anda tidak terinstall editor pico silahkan gunakan editor yang lain
ok contoh configurasi ini sudah di test dan jalan silahkan edit sesuaikan dengan kebutuhan anda
·········10········20········30········40········50········60········70········80········90········100·······110·······120·······130·······140·······150
1. #tambahkan menjadi “http_port 3128 transparent” untuk transparent proxy
2. #kalau anda tidak suka port 3128 sebagai port default proxy silahkan ganti
3. http_port 3128
4. icp_port 3130
5. #cache peer di set ke proxy yang kita tuju contoh parent proxy seperti berikut ini
6. #cache_peer 202.111.222.33 parent 7001 3130 no-query default
7. udp_incoming_address 0.0.0.0
8. udp_outgoing_address 255.255.255.255
9. hierarchy_stoplist cgi-bin ?
10. acl QUERY urlpath_regex cgi-bin \?
11. no_cache deny QUERY
12. #cache memory silahkan tentukan sendiri
13. #apabila anda menggunakan proxy server untuk keperluan yang lain maksimal memori = 1/4 total memori
14. cache_mem 128 MB
15. cache_swap_low 90
16. cache_swap_high 95
17. maximum_object_size 10240 KB
18. minimum_object_size 0 KB
19. maximum_object_size_in_memory 8 KB
20. ipcache_size 1024
21. ipcache_low 90
22. ipcache_high 95
23. fqdncache_size 1024
24. cache_replacement_policy lru
25. memory_replacement_policy lru
26. #sesuaikan ukuran cache anda disini contoh disini pakai 1Gb
27. cache_dir ufs /usr/local/squid/cache 1000 16 256
28. cache_access_log /usr/local/squid/logs/access.log
29. cache_log /usr/local/squid/logs/cache.log
30. cache_store_log /usr/local/squid/logs/store.log
31. mime_table /usr/local/etc/squid/mime.conf
32. pid_filename /usr/local/squid/logs/squid.pid
33. debug_options ALL,1
34. client_netmask 255.255.255.255
35. ftp_user Squid@
36. ftp_list_width 32
37. ftp_passive on
38. ftp_sanitycheck on
39. ftp_telnet_protocol on
40. unlinkd_program /usr/local/libexec/squid/unlinkd
41. redirect_children 10
42. auth_param basic children 10
43. auth_param basic realm Squid proxy-caching web server
44. auth_param basic credentialsttl 2 hours
45. auth_param basic casesensitive off
46.
47. refresh_pattern ^ftp: 1440 20% 10080
48. refresh_pattern ^gopher: 1440 0% 1440
49. refresh_pattern . 0 20% 4320
50. quick_abort_min 16 KB
51. quick_abort_max 16 KB
52. quick_abort_pct 95
53. negative_ttl 5 minutes
54. connect_timeout 1 minute
55. read_timeout 15 minutes
56. request_timeout 5 minutes
57. persistent_request_timeout 1 minute
58. client_lifetime 5 day
59. pconn_timeout 120 seconds
60. shutdown_lifetime 30 seconds
61.
62. #Recommended minimum configuration:
63. acl all src 0.0.0.0/0.0.0.0
64. acl manager proto cache_object
65. acl localhost src 127.0.0.1/255.255.255.255
66. acl to_localhost dst 127.0.0.0/8
67. acl SSL_ports port 443 563
68. acl Safe_ports port 80 # http
69. acl Safe_ports port 81 # http
70. acl Safe_ports port 21 # ftp
71. acl Safe_ports port 443 563 # https, snews
72. acl Safe_ports port 70 # gopher
73. acl Safe_ports port 210 # wais
74. acl Safe_ports port 1025-65535 # unregistered ports
75. acl Safe_ports port 280 # http-mgmt
76. acl Safe_ports port 488 # gss-http
77. acl Safe_ports port 591 # filemaker
78. acl Safe_ports port 777 # multiling http
79. acl Safe_ports port 4461
80. acl CONNECT method CONNECT
81.
82. http_access allow manager localhost
83. http_access deny manager
84. http_access deny !Safe_ports
85. http_access deny CONNECT !SSL_ports
86. #atur dan sesuaikan dengan ip berapa saja yang ingin anda kasih akses ke proxy
87. #disini di contohkan 192.168.0.1/24 atau 192.168.0.1 – 192.168.0.255
88. acl our_networks src 192.168.0.1/24
89. http_access allow our_networks
90. http_access deny all
91. http_reply_access allow all
92. icp_access allow all
93. miss_access allow all
94. #sesuaikan dengan mail admin proxy anda
95. cache_mgr admin@warnetgue.com
96.
97. cache_effective_user squid
98.
99. logfile_rotate 10
100. buffered_logs off
101. icon_directory /usr/local/etc/squid/icons
102. error_directory /usr/local/etc/squid/errors/English
103. snmp_port 3401
104. snmp_access allow localhost
105. snmp_access deny all
106. snmp_access deny all
107. coredump_dir /usr/local/squid/cache
108. ie_refresh on
#tambahkan menjadi “http_port 3128 transparent” untuk transparent proxy #kalau anda tidak suka port 3128 sebagai port default proxy silahkan ganti http_port 3128 icp_port 3130 #cache peer di set ke proxy yang kita tuju contoh parent proxy seperti berikut ini #cache_peer 202.111.222.33 parent 7001 3130 no-query default udp_incoming_address 0.0.0.0 udp_outgoing_address 255.255.255.255 hierarchy_stoplist cgi-bin ? acl QUERY urlpath_regex cgi-bin \? no_cache deny QUERY #cache memory silahkan tentukan sendiri #apabila anda menggunakan proxy server untuk keperluan yang lain maksimal memori = 1/4 total memori cache_mem 128 MB cache_swap_low 90 cache_swap_high 95 maximum_object_size 10240 KB minimum_object_size 0 KB maximum_object_size_in_memory 8 KB ipcache_size 1024 ipcache_low 90 ipcache_high 95 fqdncache_size 1024 cache_replacement_policy lru memory_replacement_policy lru #sesuaikan ukuran cache anda disini contoh disini pakai 1Gb cache_dir ufs /usr/local/squid/cache 1000 16 256 cache_access_log /usr/local/squid/logs/access.log cache_log /usr/local/squid/logs/cache.log cache_store_log /usr/local/squid/logs/store.log mime_table /usr/local/etc/squid/mime.conf pid_filename /usr/local/squid/logs/squid.pid debug_options ALL,1 client_netmask 255.255.255.255 ftp_user Squid@ ftp_list_width 32 ftp_passive on ftp_sanitycheck on ftp_telnet_protocol on unlinkd_program /usr/local/libexec/squid/unlinkd redirect_children 10 auth_param basic children 10 auth_param basic realm Squid proxy-caching web server auth_param basic credentialsttl 2 hours auth_param basic casesensitive off refresh_pattern ^ftp: 1440 20% 10080 refresh_pattern ^gopher: 1440 0% 1440 refresh_pattern . 0 20% 4320 quick_abort_min 16 KB quick_abort_max 16 KB quick_abort_pct 95 negative_ttl 5 minutes connect_timeout 1 minute read_timeout 15 minutes request_timeout 5 minutes persistent_request_timeout 1 minute client_lifetime 5 day pconn_timeout 120 seconds shutdown_lifetime 30 seconds #Recommended minimum configuration: 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 563 acl Safe_ports port 80 # http acl Safe_ports port 81 # 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 # gss-http acl Safe_ports port 591 # filemaker acl Safe_ports port 777 # multiling http acl Safe_ports port 4461 acl CONNECT method CONNECT http_access allow manager localhost http_access deny manager http_access deny !Safe_ports http_access deny CONNECT !SSL_ports #atur dan sesuaikan dengan ip berapa saja yang ingin anda kasih akses ke proxy #disini di contohkan 192.168.0.1/24 atau 192.168.0.1 – 192.168.0.255 acl our_networks src 192.168.0.1/24 http_access allow our_networks http_access deny all http_reply_access allow all icp_access allow all miss_access allow all #sesuaikan dengan mail admin proxy anda cache_mgr admin@warnetgue.com cache_effective_user squid logfile_rotate 10 buffered_logs off icon_directory /usr/local/etc/squid/icons error_directory /usr/local/etc/squid/errors/English snmp_port 3401 snmp_access allow localhost snmp_access deny all snmp_access deny all coredump_dir /usr/local/squid/cache ie_refresh on
START & RUN
Pertama kita bikin dulu cache dengan perintah
1. squid -z
squid -z
permasalahan yang sering terjadi adalah folder cache tidak bisa di tulis oleh user squid, untuk mengatasi nya ketik perintah ini
1. chown -R squid:squid /usr/local/squid/*
chown -R squid:squid /usr/local/squid/*
Kemudian kita coba test dengan perintah
1. squid -NCd1
squid -NCd1
Apabila diketemukan kesalahan config akan terlihat disini. Apabila semua sudah ok silahkan terminate squid dengan ctrl+c
kemudian jalankan squid dengan command
1. /usr/local/sbin/squid -D
/usr/local/sbin/squid -D
Apabila anda ingin squid jalan setiap kali restart ketikan command berikut atau anda bisa masukan squid ke startup script anda.
·········10········20········30········40········50········60········70········80········90········100·······110·······120·······130·······140·······150
1. echo “/usr/local/sbin/squid -D” >> /etc/rc.local
echo “/usr/local/sbin/squid -D” >> /etc/rc.local
Ok deh silahkan dicoba squid nya semoga berhasil

Tinggalkan Balasan