Sekedar informasi, saya membuat proxy ini di vps OpenVZ dengan OS CENTOS 5.6 i686 virtuozzo.
Berikut langkah2 proses pembuatannya.
Install squid
[root@server]# rpm -Uvh squid-2.6.STABLE21-6.el5.i386.rpm
error: open of squid-2.6.STABLE21-6.el5.i386.rpm failed: No such file or directory
Jika error seperti diatas berarti file squid belum ada di server, maka download dulu squid'nya lalu install.
Download squid
[root@server]# wget http://mirror.centos.org/centos/5.6/os/i386/CentOS/squid-2.6.STABLE21-6.el5.i386.rpm
--2011-06-05 14:58:07-- http://mirror.centos.org/centos/5.6/os/i386/CentOS/squid-2.6.STABLE21-6.el5.i386.rpm
Resolving mirror.centos.org... 66.109.26.212
Connecting to mirror.centos.org|66.109.26.212|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1333128 (1.3M) [application/x-rpm]
Saving to: `squid-2.6.STABLE21-6.el5.i386.rpm'
100%[======================================>] 1,333,128 1.45M/s in 0.9s
2011-06-05 14:58:08 (1.45 MB/s) - `squid-2.6.STABLE21-6.el5.i386.rpm' saved [1333128/1333128]
Sekarang kita install squidnya.
Install squid
[root@server]# rpm -Uvh squid-2.6.STABLE21-6.el5.i386.rpm
error: Failed dependencies:
perl(URI::URL) is needed by squid-2.6.STABLE21-6.el5.i386
Jika error seperti diatas maka download dulu perl-URI lalu install.
Download perl-URI
[root@server]# wget http://mirror.centos.org/centos/5.6/os/i386/CentOS/perl-URI-1.35-3.noarch.rpm
--2011-06-05 15:18:06-- http://mirror.centos.org/centos/5.6/os/i386/CentOS/perl-URI-1.35-3.noarch.rpm
Resolving mirror.centos.org... 69.20.131.50
Connecting to mirror.centos.org|69.20.131.50|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 118380 (116K) [application/x-rpm]
Saving to: `perl-URI-1.35-3.noarch.rpm'
100%[======================================>] 118,380 277K/s in 0.4s
2011-06-05 15:18:07 (277 KB/s) - `perl-URI-1.35-3.noarch.rpm' saved [118380/118380]
Install perl-URI
[root@server]# rpm -Uvh perl-URI-1.35-3.noarch.rpm
Preparing... ########################################### [100%]
1erl-URI ########################################### [100%]
Sekarang kita coba lagi install squid.
Install squid
[root@server]# rpm -Uvh squid-2.6.STABLE21-6.el5.i386.rpm
Preparing... ########################################### [100%]
1:squid ########################################### [100%]
Sampai pada tahap ini anda telah berhasil meng'install SQUID.
Tahap selanjutnya buka file /etc/squid/squid.conf lalu edit bagian berikut:
#http_port 3128Ubah menjadi http_port 3128 dan kalau anda ingin merubah port'nya silahakan ganti 3128.
#via onFungsi ini akan menampilkan data header _SERVER['HTTP_VIA']. Jadi orang lain bisa melihat server dan proxy anda.
Contoh akan tampil seperti ini:
1.1 server.realwap.net:3128 (squid/2.6.STABLE21)Jadi untuk keamanan ubah #via on menjadi via off agar data header _SERVER['HTTP_VIA'] tidak tampil lagi.
Selanjutnya cari:
http_access deny allUbah http_access deny all menjadi http_access allow all agar proxy bisa di gunakan untuk semua client.
Tahap terakhir start squid anda.
/etc/init.d/squid startSampai pada tahap ini ada sudah bisa menggunakan proxy sesuai ip server dan port yang telah anda buat tadi.
CARA MEMBUAT USER DAN PASSWORD PROXY:
1) pertama buat file password
aku lebih suka menamakan nama squid_passwd
walau ada juga yang memakai auth_squid dll.dan pastikan dapat dibaca universal.
[root@server]# touch /etc/squid/squid_passwd
[root@server ]# chmod o+r /etc/squid/squid_passwd
2) Gunakan program htpasswd untuk menambahkan user ke file password. kita bisa menambahkan user setiap saat tanpa harus merestart Squid.
misal saya membuat satu username kata "onwer".
Add or modify user
[root@server]# htpasswd /etc/squid/squid_passwd onwer
New password:
Re-type new password:
Adding password for user onwer
Delete user
[root@server]#htpasswd -D /etc/squid/squid_passwd onwer
Deleting password for user onwer
3) Temukan file ncsa_auth menggunakan perintah grep (untuk centos,fedora).
[root@server]# rpm -ql squid | grep ncsa_auth
/usr/lib/squid/ncsa_auth
Selanjutnya buka file /etc/squid/squid.conf lalu edit bagian berikut:
#auth_param basic program
#auth_param basic children 5
#auth_param basic realm Squid proxy-caching web server
#auth_param basic credentialsttl 2 hours
#auth_param basic casesensitive off
auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/squid_passwd
auth_param basic children 5
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 2 hours
auth_param basic casesensitive off
http_access allow all
acl ncsa_users proxy_auth REQUIRED
http_access allow ncsa_users
/etc/init.d/squid restart
No comments:
Post a Comment