Cara Install Squid Proxy Server di Ubuntu 20.04 dan 22.04 Update & Lengkap

Cara Install Squid Proxy Server di Ubuntu 20.04 dan 22.04 Update & Lengkap
Cara Install Squid Proxy Server di Ubuntu 20.04 dan 22.04 Update & Lengkap

Dalam artikel ini Qiannah Update Media akan memberikan tutorial install Squid Proxy Server tanpa password dan menggunakan password bagi kalian yang ingin menggunakan serta memiliki proxy server sendiri untuk mendukung aktifitas online.

Cara Install Squid Proxy Server

Cara Install Squid Proxy Server
Cara Install Squid Proxy Server di Ubuntu 20.04 dan 22.04 Update & Lengkap 3

Login Ke VPS

Sebelum melakukan instalasi Squid Proxy server langkah pertama yang harus kalian lakukan adalah login terlebih dahulu ke VPS server yang kalian miliki melalui akses SSH, untuk aplikasinya sendiri dapat kalian sesuaikan dengan aplikasi yang kalian suka atau menggunakan Putty yang simple dan mudah.

Mengubah Akses Ke Root

Apabila kalian belum menjadi Root, kami sarankan untuk mengubah akses kalian menjadi root terlebih dahulu dengan menjalankan perintah su kemudian masukkan password root kalian. Apabila kalian lupa atau tidak mengetahui password root, silahkan ubah terlebih dahulu dengan menjalankan perintah sudo passwd kemudian masukkan password sebanyak 2 kali dimana pertama adalh password dan kedua verifikasi password.

Update dan Upgrade Sistem Server

Setelah kalian menjadi super user maka langkah selanjutnya adalah melakukan update serta upgrade sistem server terlebih dahulu agar menggunakan sistem dan software terbaru dengan menjalankan perintah

apt update && apt upgrade -y && apt dist-upgrade -y

Kemudian tunggu hingga prosesnya selesai. Untuk estimasi waktunya sendiri tergantung dari spesifikasi server yang kalian gunakan.

Install Squid Proxy Server dan Nano Editor

Setelah proses update dan upgrade selesai maka langkah selanjutnya adalah instalasi Squid dan nano editor dengan menjalankan perintah dibawah ini

apt -y install nano && apt -y install squid && apt install -y apache2-utils

Dan tunggu hingga prosesnya selesai.

BACA JUGA  Cara Membuat VPS Windows VULTR Terbaru & Lengkap 2023

Hapus File Squid.conf Default

Selanjutnya setelah proses instalasi selesai maka kita akan menghapus file squid.conf karena kita akan menggunakan file configurasi yang telah disesuaikan. Untuk langkahnya sendiri silahkan jalankan perintah berikut

rm /etc/squid/squid.conf

Membuat File Squid.conf baru

Setelah menghapus maka kita akan membuat file squid.conf terbaru dengan menjalankan perintah

touch /etc/squid/squid.conf

Membuka File Squid.Conf

Setelah membuat file configurasi baru silahkan kalian buka file konfigurasi tersebut dengan menjalankan perintah

nano /etc/squid/squid.conf

Setelah kalian membuka maka tampilan squid.conf tersebut masih kosong. SIlahkan kalian paste kan file konfigurasi baru dengan cara klik kanan mouse pada kolom kosong.

Untuk file konfigurasinya pada akhir artikel.

Simpan file Squid.Conf

Setelah mempastekan file konfigurasi maka langkah selanjutnya adalah menyimpan dengan cara CTRL + X kemudian Y enter.

Membuat Password Khusus Kalian Yang Ingin Menggunakan Password

systemctl reload squid.service && touch /etc/squid/passwd && chown proxy: /etc/squid/passwd
htpasswd /etc/squid/passwd username

Ubah Username menjadi username kalian kemudian tekan enter dan masukkan password yang kalian inginkan.

Restart Squid Proxy Server

Tanpa Password

systemctl reload squid.service

File Konfigurasi Squid Proxy Server Tanpa Password

acl localnet src 0.0.0.1-0.255.255.255	# RFC 1122 "this" network (LAN)
acl localnet src 10.0.0.0/8		# RFC 1918 local private network (LAN)
acl localnet src 100.64.0.0/10		# RFC 6598 shared address space (CGN)
acl localnet src 169.254.0.0/16 	# RFC 3927 link-local (directly plugged) machines
acl localnet src 172.16.0.0/12		# RFC 1918 local private network (LAN)
acl localnet src 192.168.0.0/16		# RFC 1918 local private network (LAN)
acl localnet src fc00::/7       	# RFC 4193 local private network range
acl localnet src fe80::/10      	# RFC 4291 link-local (directly plugged) machines

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 deny !Safe_ports

http_access deny CONNECT !SSL_ports

http_access allow localhost manager
http_access deny manager

include /etc/squid/conf.d/*

http_access allow localhost

# allow all requests    
acl all src 0.0.0.0/0
http_access allow all

# And finally deny all other access to this proxy
http_access deny all

http_port 3128

#acl ip1 myip 155.138.211.40
#acl ip2 myip 155.138.204.186
#acl ip3 myip 155.138.235.182

#tcp_outgoing_address 155.138.211.40 ip1
#tcp_outgoing_address 155.138.204.186 ip2
#tcp_outgoing_address 155.138.235.182 ip3

coredump_dir /var/spool/squid

refresh_pattern (Release|Packages(.gz)*)$      0       20%     2880
# example lin deb packages
#refresh_pattern (\.deb|\.udeb)$   129600 100% 129600
refresh_pattern .		0	20%	4320

refresh_pattern -i \.htm 120 50% 10080 reload-into-ims
refresh_pattern -i \.html 120 50% 10080 reload-into-ims
refresh_pattern ^http://*.gmail.*/.* 720 100% 4320
refresh_pattern ^http://*.google.*/.* 720 100% 4320
refresh_pattern ^http://*.googlesyndication.*/.* 720 100% 4320
refresh_pattern ^.*(utm\.gif|ads\?|rmxads\.com|ad\.z5x\.net|bh\.contextweb\.com|bstats\.adbrite\.com|a1\.interclick\.com|ad\.trafficmp\.com|ads\.cubics\.com|ad\.xtendmedia\.com|\.googlesyndication\.com|advertising\.com|yieldmanager|game-advertising\.com|pixel\.quantserve\.com|adperium\.com|doubleclick\.net|adserving\.cpxinteractive\.com|syndication\.com|media.fastclick.net).* 10800 20% 10800 ignore-no-cache  ignore-private override-expire ignore-reload ignore-auth   negative-ttl=40320 max-stale=10
refresh_pattern ^.*safebrowsing.*google  10800 80% 10800 override-expire ignore-reload ignore-no-cache ignore-private ignore-auth  negative-ttl=10080
refresh_pattern ^http://((cbk|mt|khm|mlt)[0-9]?)\.google\.co(m|\.uk) 10800 80% 10800 override-expire ignore-reload   ignore-private  negative-ttl=10080
refresh_pattern ytimg\.com.*\.jpg                   10800 80% 10800    override-expire ignore-reload
refresh_pattern photobucket.*\.(jp(e?g|e|2)|tiff?|bmp|gif|png)  10800 80% 10800     override-expire ignore-reload
refresh_pattern vid\.akm\.dailymotion\.com.*\.on2\?           10800 80% 10800 ignore-no-cache override-expire override-lastmod
refresh_pattern mediafire.com\/images.*\.(jp(e?g|e|2)|tiff?|bmp|gif|png)    10800 80% 10800 reload-into-ims override-expire ignore-private
refresh_pattern ^http:\/\/images|pics|thumbs[0-9]\.      10800 80% 10800 reload-into-ims ignore-no-cache  ignore-reload override-expire
# ANTI VIRUS
refresh_pattern guru.avg.com/.*\.(bin)                      10800 80% 10800 ignore-no-cache  ignore-reload  reload-into-ims
refresh_pattern (avgate|avira).*(idx|gz)$                           10800 80% 10800 ignore-no-cache  ignore-reload  reload-into-ims
refresh_pattern kaspersky.*\.avc$                                   10800 80% 10800 ignore-no-cache  ignore-reload  reload-into-ims
refresh_pattern kaspersky                                           10800 80% 10800 ignore-no-cache  ignore-reload  reload-into-ims
refresh_pattern update.nai.com/.*\.(gem|zip|mcs)                    10800 80% 10800 ignore-no-cache  ignore-reload  reload-into-ims
refresh_pattern ^http:\/\/liveupdate.symantecliveupdate.com.*\(zip)     10800 80% 10800 ignore-no-cache  ignore-reload  reload-into-ims
 
refresh_pattern windowsupdate.com/.*\.(cab|exe)             10800  80%  10800 ignore-no-cache  ignore-reload  reload-into-ims
refresh_pattern update.microsoft.com/.*\.(cab|exe)             10800  80%  10800 ignore-no-cache  ignore-reload  reload-into-ims
refresh_pattern download.microsoft.com/.*\.(cab|exe)             10800  80%  10800 ignore-no-cache  ignore-reload  reload-into-ims
#banner IIX
refresh_pattern ^http:\/\/openx.*\.(jp(e?g|e|2)|gif|pn[pg]|swf|ico|css|tiff?) 10800 99999% 10800 reload-into-ims  ignore-reload override-expire ignore-no-cache
refresh_pattern ^http:\/\/ads(1|2|3).kompas.com.*\/           10800 99999% 10800 reload-into-ims  ignore-reload override-expire ignore-no-cache
refresh_pattern ^http:\/\/img.ads.kompas.com.*\/           10800 99999% 10800 reload-into-ims  ignore-reload override-expire ignore-no-cache
refresh_pattern .kompasimages.com.*\.(jpg|gif|png|swf)       10800 99999% 10800 reload-into-ims  ignore-reload override-expire ignore-no-cache
refresh_pattern ^http:\/\/openx.kompas.com.*\/           10800 99999% 10800 reload-into-ims  ignore-reload override-expire ignore-no-cache
refresh_pattern kaskus.\us.*\.(jp(e?g|e|2)|gif|png|swf)        10800 99999% 10800 reload-into-ims  ignore-reload override-expire ignore-no-cache
refresh_pattern ^http:\/\/img.kaskus.us.*\.(jpg|gif|png|swf)       10800 99999% 10800 reload-into-ims  ignore-reload override-expire ignore-no-cache
 
#IIX DOWNLOAD
refresh_pattern ^http:\/\/\.www[0-9][0-9]\.indowebster\.com\/(.*)(mp3|rar|zip|flv|wmv|3gp|mp(4|3)|exe|msi|zip) 10800 99999% 10800 reload-into-ims  ignore-reload override-expire ignore-no-cache    ignore-auth
 
#All File
refresh_pattern -i \.(3gp|7z|ace|asx|avi|bin|cab|dat|deb|divx|dvr-ms)      10800 80% 10800 ignore-no-cache  ignore-private override-expire override-lastmod reload-into-ims
refresh_pattern -i \.(rar|jar|gz|tgz|bz2|iso|m1v|m2(v|p)|mo(d|v))          10800 80% 10800 ignore-no-cache  ignore-private override-expire override-lastmod reload-into-ims
refresh_pattern -i \.(jp(e?g|e|2)|gif|pn[pg]|bm?|tiff?|ico|swf|css|js)     10800 80% 10800 ignore-no-cache  ignore-private override-expire override-lastmod reload-into-ims
refresh_pattern -i \.(mp(e?g|a|e|1|2|3|4)|mk(a|v)|ms(i|u|p)|og(x|v|a|g)|rar|rm|r(a|p)m|snd|vob|wav) 10800 80% 10800 ignore-no-cache ignore-private override-expire override-lastmod reload-into-ims
refresh_pattern -i \.(pp(s|t)|wax|wm(a|v)|wmx|wpl|zip|cb(r|z|t))     10800 80% 10800 ignore-no-cache ignore-private override-expire override-lastmod reload-into-ims
 
refresh_pattern (cgi-bin|\?)       0      0%      0
refresh_pattern ^gopher:    1440    0%    1440
refresh_pattern ^ftp:         10080     95%     10800 override-lastmod reload-into-ims
refresh_pattern         .     180     95% 10800 override-lastmod reload-into-ims

File Konfigurasi Squid Proxy server Dengan Password

auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/passwd
auth_param basic children 5
auth_param basic realm Squid Basic Authentication
auth_param basic credentialsttl 2 hours
acl auth_users proxy_auth REQUIRED
http_access allow auth_users

acl localnet src 0.0.0.1-0.255.255.255	# RFC 1122 "this" network (LAN)
acl localnet src 10.0.0.0/8		# RFC 1918 local private network (LAN)
acl localnet src 100.64.0.0/10		# RFC 6598 shared address space (CGN)
acl localnet src 169.254.0.0/16 	# RFC 3927 link-local (directly plugged) machines
acl localnet src 172.16.0.0/12		# RFC 1918 local private network (LAN)
acl localnet src 192.168.0.0/16		# RFC 1918 local private network (LAN)
acl localnet src fc00::/7       	# RFC 4193 local private network range
acl localnet src fe80::/10      	# RFC 4291 link-local (directly plugged) machines

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 deny !Safe_ports

http_access deny CONNECT !SSL_ports

http_access allow localhost manager
http_access deny manager

include /etc/squid/conf.d/*

http_access allow localhost

# allow all requests    
acl all src 0.0.0.0/0
http_access allow all

# And finally deny all other access to this proxy
http_access deny all

http_port 3128

#acl ip1 myip 155.138.211.40
#acl ip2 myip 155.138.204.186
#acl ip3 myip 155.138.235.182

#tcp_outgoing_address 155.138.211.40 ip1
#tcp_outgoing_address 155.138.204.186 ip2
#tcp_outgoing_address 155.138.235.182 ip3

coredump_dir /var/spool/squid

refresh_pattern ^ftp:		1440	20%	10080
refresh_pattern ^gopher:	1440	0%	1440
refresh_pattern -i (/cgi-bin/|\?) 0	0%	0
refresh_pattern \/(Packages|Sources)(|\.bz2|\.gz|\.xz)$ 0 0% 0 refresh-ims
refresh_pattern \/Release(|\.gpg)$ 0 0% 0 refresh-ims
refresh_pattern \/InRelease$ 0 0% 0 refresh-ims
refresh_pattern \/(Translation-.*)(|\.bz2|\.gz|\.xz)$ 0 0% 0 refresh-ims
# example pattern for deb packages
#refresh_pattern (\.deb|\.udeb)$   129600 100% 129600
refresh_pattern .		0	20%	4320

Itulah tadi tutorial yang bisa kami berikan, semoga dapat membantu kalian.

BACA JUGA  2 Cara Install Wordpress Cyberpanel Lengkap
Penulis: Citra, S.KomEditor: Andini Yustina, S.Kom