Cara Install Squid Sederhana

05 Mei 2017

Jasa setting mikrotik Murah - jasa setting mikrotik seluruh indonesia. Dalam tulisan ini saya tidak membahas soal mikrotik tapi membahasa router lain yakni ubuntu server, dimana pokok bahasannya Cara Install Squid Sederhana - bagimana cara install squid secara sederhana.



Cara Install Squid Sederhana - sebagai materi sekaligus contoh di kelas XI_TKJ.  Langkah pertama dalam menginstall squid sederhana, dimana squid yang di gunakan adalah squid lusca.

apt-get update
apt-get install build-essential sharutils 
wget http://wifismartzone.com/files/linux_related/lusca/LUSCA_HEAD-r14942.tar.gz
tar -zxvf LUSCA_HEAD-r14942.tar.gz
cd LUSCA_HEAD-r14942

./configure --prefix=/usr \
--exec-prefix=/usr \
--bindir=/usr/sbin \
--sbindir=/usr/sbin \
--libexecdir=/usr/libexec/squid \
--sysconfdir=/etc/squid \
--localstatedir=/var/log/squid \
--datadir=/usr/share/squid \
--enable-async-io=24 \
--with-aufs-threads=24 \
--with-pthreads \
--enable-storeio=aufs,coss,null \
--disable-linux-netfilter \
--enable-kqueue \
--enable-arp-acl \
--disable-linux-tproxy \
--disable-epoll \
--enable-removal-policies=heap \
--with-aio --with-dl \
--enable-snmp \
--enable-delay-pools \
--enable-htcp \
--enable-cache-digests \
--disable-unlinkd \
--enable-large-cache-files \
--with-large-files \
--enable-err-languages=English \
--enable-default-err-language=English \
--with-maxfd=65536

make clean
make
make isntall

Langkah selanjutnya

root@ubuntu:~/LUSCA_HEAD-r14942# cd /etc/squid
root@ubuntu:/etc/squid# ls -al
total 408
drwxr-xr-x  2 root root   4096 May  5 10:48 .
drwxr-xr-x 87 root root   4096 May  5 10:48 ..
-rw-r--r--  1 root root    419 May  5 10:48 cachemgr.conf
-rw-r--r--  1 root root  11651 May  5 10:48 mime.conf
-rw-r--r--  1 root root  11651 May  5 10:48 mime.conf.default
-rw-r--r--  1 root root 186147 May  5 10:48 squid.conf
-rw-r--r--  1 root root   3692 May  5 10:48 squid.conf.clean
-rw-r--r--  1 root root 186147 May  5 10:48 squid.conf.default
root@ubuntu:/etc/squid# squid -v
Squid Cache: Version LUSCA_HEAD-r14942
configure options:  '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/sbin' '--sbindir=/usr/sbin' '--libexecdir=/usr/libexec/squid' '--sysconfdir=/etc/squid' '--localstatedir=/var/log/squid' '--datadir=/usr/share/squid' '--enable-async-io=24'
root@ubuntu:/etc/squid# ls -al
total 408
drwxr-xr-x  2 root root   4096 May  5 10:48 .
drwxr-xr-x 87 root root   4096 May  5 10:48 ..
-rw-r--r--  1 root root    419 May  5 10:48 cachemgr.conf
-rw-r--r--  1 root root  11651 May  5 10:48 mime.conf
-rw-r--r--  1 root root  11651 May  5 10:48 mime.conf.default
-rw-r--r--  1 root root 186147 May  5 10:48 squid.conf
-rw-r--r--  1 root root   3692 May  5 10:48 squid.conf.clean
-rw-r--r--  1 root root 186147 May  5 10:48 squid.conf.default
root@ubuntu:/etc/squid# rm -rf squid.conf
root@ubuntu:/etc/squid# nano squid.conf

Ini squidcconfignya
http_port 3128 transparent
server_http11 on

# Various Logs/files location
pid_filename /var/run/squid.pid
coredump_dir /var/spool/squid/
access_log /var/log/squid/access.log
cache_log none
cache_store_log none

# Cache Policy
cache_mem 6 MB

minimum_object_size 0 KB
maximum_object_size 10 GB
cache_swap_low 98
cache_swap_high 99

# Cache Folder Path, using 5GB for test
cache_dir aufs /var/log/squid/cache 1000 16 256

# ACL Section
acl all src all
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8
acl localnet src 10.0.0.0/8            # RFC1918 possible internal network
acl localnet src 172.16.0.0/12        # RFC1918 possible internal network
acl localnet src 192.168.0.0/16        # RFC1918 possible internal network

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
acl purge method PURGE

#==== End Rules: Advertising ====

strip_query_terms off

refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern ^ftp: 10080 95% 10080 override-lastmod reload-into-ims
refresh_pattern . 0 20% 10080 override-lastmod reload-into-ims

http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localnet
http_access allow all
http_access deny all

forwarded_for off
header_access From deny all
http_access allow localnet
http_access allow all
http_access deny all

forwarded_for off
header_access From deny all
header_access Server deny all
header_access Link deny all
header_access Via deny all
header_access X-Forwarded-For deny all
httpd_suppress_version_string on

shutdown_lifetime 10 seconds
memory_pools off
retry_on_error on

strip_query_terms off

query_icmp on
reload_into_ims on
emulate_httpd_log off
negative_ttl 0 seconds
pipeline_prefetch on
vary_ignore_expire on
half_closed_clients off
high_page_fault_warning 2
nonhierarchical_direct on
prefer_direct off
cache_effective_user proxy
cache_effective_group proxy
visible_hostname teruna
unique_hostname gun
client_db on

root@ubuntu:/etc/squid# squid -z
FATAL: Failed to make swap directory /var/log/squid/cache: (13) Permission denied
Squid Cache (Version LUSCA_HEAD-r14942): Terminated abnormally.
CPU Usage: 0.004 seconds = 0.004 user + 0.000 sys
Maximum Resident Size: 3104 KB
Page faults with physical i/o: 0
root@ubuntu:/etc/squid# mkdir /var/log/squid/cache
root@ubuntu:/etc/squid# chmod 777 /var/log/squid/cache
root@ubuntu:/etc/squid# chown proxy:proxy -R /var/log/squid/cache
root@ubuntu:/etc/squid# squid -z
root@ubuntu:/etc/squid# squid -NdCi

2017/05/05 10:50:52| NOTICE: maximum_object_size limited to 4194240 KB due to OS limitations
WARNING: Cannot write log file: none
none: Permission denied
         messages will be sent to 'stderr'.
2017/05/05 10:50:52| WARNING: Closing open FD    2
2017/05/05 10:50:52| Starting Squid Cache version LUSCA_HEAD-r14942 for i686-pc-linux-gnu...
2017/05/05 10:50:52| Starting Squid Cache version LUSCA_HEAD-r14942 for i686-pc-linux-gnu...
2017/05/05 10:50:52| Process ID 20011
2017/05/05 10:50:52| With 1024 file descriptors available
2017/05/05 10:50:52| Using epoll for the IO loop
2017/05/05 10:50:52| Performing DNS Tests...
2017/05/05 10:50:52| Successful DNS name lookup tests...
2017/05/05 10:50:52| Adding nameserver 8.8.8.8 from /etc/resolv.conf
2017/05/05 10:50:52| DNS Socket created at 0.0.0.0, port 52214, FD 6
2017/05/05 10:50:52| logfileOpen: opening log /var/log/squid/access.log
FATAL: Cannot open '/var/log/squid/access.log' for writing.
        The parent directory must be writeable by the
        user 'proxy', which is the cache_effective_user
        set in squid.conf.
Squid Cache (Version LUSCA_HEAD-r14942): Terminated abnormally.
CPU Usage: 0.072 seconds = 0.004 user + 0.068 sys
Maximum Resident Size: 7472 KB
Page faults with physical i/o: 0
Aborted (core dumped)


root@ubuntu:/etc/squid# mkdir /var/log/squid/
mkdir: cannot create directory `/var/log/squid/': File exists
root@ubuntu:/etc/squid# chmod 755 /var/log/squid/
root@ubuntu:/etc/squid# chown proxy:proxy /var/log/squid/cache
root@ubuntu:/etc/squid# squid -NdCI

2017/05/05 10:52:15| NOTICE: maximum_object_size limited to 4194240 KB due to OS limitations
WARNING: Cannot write log file: none
none: Permission denied
         messages will be sent to 'stderr'.
2017/05/05 10:52:15| WARNING: Closing open FD    2
2017/05/05 10:52:15| Starting Squid Cache version LUSCA_HEAD-r14942 for i686-pc-linux-gnu...
2017/05/05 10:52:15| Starting Squid Cache version LUSCA_HEAD-r14942 for i686-pc-linux-gnu...
2017/05/05 10:52:15| Process ID 20016
2017/05/05 10:52:15| With 1024 file descriptors available
2017/05/05 10:52:15| Using epoll for the IO loop
2017/05/05 10:52:15| Performing DNS Tests...
2017/05/05 10:52:15| Successful DNS name lookup tests...
2017/05/05 10:52:15| Adding nameserver 8.8.8.8 from /etc/resolv.conf
2017/05/05 10:52:15| DNS Socket created at 0.0.0.0, port 37457, FD 6
2017/05/05 10:52:15| logfileOpen: opening log /var/log/squid/access.log
FATAL: Cannot open '/var/log/squid/access.log' for writing.
        The parent directory must be writeable by the
        user 'proxy', which is the cache_effective_user
        set in squid.conf.
Squid Cache (Version LUSCA_HEAD-r14942): Terminated abnormally.
CPU Usage: 0.044 seconds = 0.000 user + 0.044 sys
Maximum Resident Size: 7472 KB
Page faults with physical i/o: 0
Aborted (core dumped)


root@ubuntu:/etc/squid# touch /var/log/squid/access.log
root@ubuntu:/etc/squid# chmod 777 /var/log/squid/access.log
root@ubuntu:/etc/squid# chown proxy:proxy /var/log/squid/access.log
root@ubuntu:/etc/squid# squid -NdCI


2017/05/05 10:52:45| NOTICE: maximum_object_size limited to 4194240 KB due to OS limitations
WARNING: Cannot write log file: none
none: Permission denied
         messages will be sent to 'stderr'.
2017/05/05 10:52:45| WARNING: Closing open FD    2
2017/05/05 10:52:45| Starting Squid Cache version LUSCA_HEAD-r14942 for i686-pc-linux-gnu...
2017/05/05 10:52:45| Starting Squid Cache version LUSCA_HEAD-r14942 for i686-pc-linux-gnu...
2017/05/05 10:52:45| Process ID 20021
2017/05/05 10:52:45| With 1024 file descriptors available
2017/05/05 10:52:45| Using epoll for the IO loop
2017/05/05 10:52:45| Performing DNS Tests...
2017/05/05 10:52:45| Successful DNS name lookup tests...
2017/05/05 10:52:45| Adding nameserver 8.8.8.8 from /etc/resolv.conf
2017/05/05 10:52:45| DNS Socket created at 0.0.0.0, port 38665, FD 6
2017/05/05 10:52:45| logfileOpen: opening log /var/log/squid/access.log
2017/05/05 10:52:45| Unlinkd pipe opened on FD 10
2017/05/05 10:52:45| Swap maxSize 1024000 + 6144 KB, estimated 79241 objects
2017/05/05 10:52:45| Target number of buckets: 3962
2017/05/05 10:52:45| Using 8192 Store buckets
2017/05/05 10:52:45| Max Mem  size: 6144 KB
2017/05/05 10:52:45| Max Swap size: 1024000 KB
2017/05/05 10:52:45| Store logging disabled
2017/05/05 10:52:45| AUFS: /var/log/squid/cache: log '/var/log/squid/cache/swap.state' opened on FD 11
2017/05/05 10:52:45| AUFS: /var/log/squid/cache: tmp log /var/log/squid/cache/swap.state.new opened on FD 11
2017/05/05 10:52:45| Rebuilding storage in /var/log/squid/cache (DIRTY)
2017/05/05 10:52:45| Using Least Load store dir selection
2017/05/05 10:52:45| chdir: /var/spool/squid/: (2) No such file or directory
2017/05/05 10:52:45| chdir: /var/spool/squid/: (2) No such file or directory
2017/05/05 10:52:45| Current Directory is /etc/squid
2017/05/05 10:52:45| ufs_rebuild: /var/log/squid/cache: rebuild type: REBUILD_DISK
2017/05/05 10:52:45| ufs_rebuild: /var/log/squid/cache: beginning rebuild from directory
2017/05/05 10:52:45| Loaded Icons.
2017/05/05 10:52:45| Accepting transparently proxied HTTP connections at 0.0.0.0, port 3128, FD 13.
2017/05/05 10:52:45| Accepting ICP messages at 0.0.0.0, port 3130, FD 14.
2017/05/05 10:52:45| WCCP Disabled.
2017/05/05 10:52:45| Ready to serve requests.
2017/05/05 10:52:45| Store rebuilding is  0.0% complete
2017/05/05 10:52:45|   /var/log/squid/cache: completed rebuild
2017/05/05 10:52:45| Done scanning /var/log/squid/cache (0 entries)
2017/05/05 10:52:45| AUFS: /var/log/squid/cache: tmp log closed on FD 11
2017/05/05 10:52:45| AUFS: /var/log/squid/cache: post-rename; log /var/log/squid/cache/swap.state, opened on FD 11
2017/05/05 10:52:45| Finished rebuilding storage from disk.
2017/05/05 10:52:45|         0 Entries scanned
2017/05/05 10:52:45|         0 Invalid entries.
2017/05/05 10:52:45|         0 With invalid flags.
2017/05/05 10:52:45|         0 Objects loaded.
2017/05/05 10:52:45|         0 Objects expired.
2017/05/05 10:52:45|         0 Objects cancelled.
2017/05/05 10:52:45|         0 Duplicate URLs purged.
2017/05/05 10:52:45|         0 Swapfile clashes avoided.
2017/05/05 10:52:45|   Took 0.6 seconds (   0.0 objects/sec).
2017/05/05 10:52:45| Beginning Validation Procedure
2017/05/05 10:52:45|   Completed Validation Procedure
2017/05/05 10:52:45|   Validated 0 Entries
2017/05/05 10:52:45|   store_swap_size = 0k
2017/05/05 10:52:46| storeLateRelease: released 0 objects
2017/05/05 10:52:49| Preparing for shutdown after 0 requests
2017/05/05 10:52:49| Waiting 0 seconds for active connections to finish
2017/05/05 10:52:49| FD 13 Closing HTTP connection
2017/05/05 10:52:50| Shutting down...
2017/05/05 10:52:50| FD 14 Closing ICP connection
2017/05/05 10:52:50| aioSync: flushing pending I/O operations
2017/05/05 10:52:50| aioSync: done
2017/05/05 10:52:50| Closing unlinkd pipe on FD 10
2017/05/05 10:52:50| storeDirWriteCleanLogs: Starting...
2017/05/05 10:52:50| AUFS: /var/log/squid/cache: log closed on FD 11
2017/05/05 10:52:50|   Finished.  Wrote 0 entries.
2017/05/05 10:52:50|   Took 0.0 seconds (   0.0 entries/sec).
CPU Usage: 0.124 seconds = 0.028 user + 0.096 sys
Maximum Resident Size: 18704 KB
Page faults with physical i/o: 0
Memory usage for squid via mallinfo():
        total space in arena:    2036 KB
        Ordinary blocks:         1942 KB      7 blks
        Small blocks:               0 KB      4 blks
        Holding blocks:           736 KB      1 blks
        Free Small blocks:          0 KB
        Free Ordinary blocks:      93 KB
        Total in use:            2678 KB 97%
        Total free:                93 KB 3%
2017/05/05 10:52:50| aioSync: flushing pending I/O operations
2017/05/05 10:52:50| aioSync: done
2017/05/05 10:52:50| logfileClose: closing log /var/log/squid/access.log
2017/05/05 10:52:50| aioSync: flushing pending I/O operations
2017/05/05 10:52:50| aioSync: done
2017/05/05 10:52:50| Squid Cache (Version LUSCA_HEAD-r14942): Exiting normally.

Untuk daemon start squidnya
cd /etc/init.d/ 
wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/mentari/squid
chown proxy:proxy squid
chmod 777 squid

/etc/init.d/squid start 

Tidak ada komentar:

Posting Komentar