Instalando o Lusca Cache (Squid) + Thunder Cache 3
O objetivo deste post é ensinar/informar como instalar o Lusca Cache trabalhando em conjunto com o Thunder Cache.
Informações
O objetivo deste post é ensinar/informar como instalar o Lusca Cache trabalhando em conjunto com o Thunder Cache.
O Lusca Cache é um fork do Squid (Squid totalmente reescrito, veja mais em http://www.lusca.org/), que tem como finalidade corrigir suas deficiências, visando ter maior estabilidade e funcionalidade que o projeto original.
Já o Thunder Cache é uma iniciativa do Luiz Biazus e do Rodrigo Manga (www.thundercache.org), que trabalha em conjunto ao Squid ou Lusca, reescrevendo URLs e armazenando os arquivos em disco e disponibilizando na próxima solicitação, não sendo necessário baixá-lo novamente da internet. A economia de link de internet pode chegar aos 40% em alguns casos. Em provedor com link saturado é uma mão na roda!
Ambiente de laboratório:
# wget -c http://lusca-cache.googlecode.com/files/LUSCA_HEAD-r14371.tar.gz
Download do Thunder Cache 3:
# wget -c http://www.biazus.com/forum/download/file.php?id=179
Descompactando os pacotes baixados.
Lusca:
# tar -xzvf http://lusca-cache.googlecode.com/files/LUSCA_HEAD-r14371.tar.gz
Thunder 3:
# mkdir /root/thunder3
# tar xjvf thunder3-32bits.tar.bz2 -C /root/thunder3
# ./configure --libexecdir=/usr/lib/squid --localstatedir=/var --prefix=/usr --sysconfdir=/etc/squid --enable-async-io --with-pthreads --enable-heap-replacement --enable-coss-aio-ops --enable-ssl --enable-htcp --enable-arp-acl --enable-removal-policies=lru,heap --disable-hostname-checks --enable-default-err-language=Portuguese --enable-err-languages=Portuguese --enable-linux-netfilter --enable-snmp --disable-ident-lookups --with-maxfd=65536 --enable-storeio=aufs,null,coss --enable-epoll
Após o configure:
# make && make install
Segue abaixo o squid.conf utilizado no laboratório:
Altere o IP 172.16.0.3 para o IP do seu servidor proxy cache.
O Lusca Cache é um fork do Squid (Squid totalmente reescrito, veja mais em http://www.lusca.org/), que tem como finalidade corrigir suas deficiências, visando ter maior estabilidade e funcionalidade que o projeto original.
Já o Thunder Cache é uma iniciativa do Luiz Biazus e do Rodrigo Manga (www.thundercache.org), que trabalha em conjunto ao Squid ou Lusca, reescrevendo URLs e armazenando os arquivos em disco e disponibilizando na próxima solicitação, não sendo necessário baixá-lo novamente da internet. A economia de link de internet pode chegar aos 40% em alguns casos. Em provedor com link saturado é uma mão na roda!
Ambiente de laboratório:
- Distro: Slackware Linux 12.2, instalação full
- Pacotes necessários: Lusca Cache, Thunder Cache 3
Download e descompactação dos pacotes
Download do Lusca:# wget -c http://lusca-cache.googlecode.com/files/LUSCA_HEAD-r14371.tar.gz
Download do Thunder Cache 3:
# wget -c http://www.biazus.com/forum/download/file.php?id=179
Descompactando os pacotes baixados.
Lusca:
# tar -xzvf http://lusca-cache.googlecode.com/files/LUSCA_HEAD-r14371.tar.gz
Thunder 3:
# mkdir /root/thunder3
# tar xjvf thunder3-32bits.tar.bz2 -C /root/thunder3
Compilando o Lusca
Execute:# ./configure --libexecdir=/usr/lib/squid --localstatedir=/var --prefix=/usr --sysconfdir=/etc/squid --enable-async-io --with-pthreads --enable-heap-replacement --enable-coss-aio-ops --enable-ssl --enable-htcp --enable-arp-acl --enable-removal-policies=lru,heap --disable-hostname-checks --enable-default-err-language=Portuguese --enable-err-languages=Portuguese --enable-linux-netfilter --enable-snmp --disable-ident-lookups --with-maxfd=65536 --enable-storeio=aufs,null,coss --enable-epoll
Após o configure:
# make && make install
Segue abaixo o squid.conf utilizado no laboratório:
http_port 3128 transparent
icp_port 0
cache_replacement_policy heap LFUDA
cache_dir aufs /cache/squid/01 20000 256 256
memory_replacement_policy heap GDSF
cache_mem 128 MB
maximum_object_size 256 MB
minimum_object_size 0 KB
maximum_object_size_in_memory 256 KB
cache_swap_low 90
cache_swap_high 95
ipcache_size 1024
fqdncache_size 1024
#
# Configuração proxy estática ------------------------------------------
#
ipcache_low 90
ipcache_high 95
#hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY
mime_table /etc/squid/mime.conf
pid_filename /var/run/proxy.pid
debug_options ALL,1
log_fqdn off
refresh_pattern ^ftp: 15 20% 2280
refresh_pattern ^gopher: 15 0% 2280
refresh_pattern . 15 20% 2280
acl all src 0.0.0.0/0
acl redeinterna src 172.16.0.0/12
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 82
acl Safe_ports port 80 # 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 CONNECT method CONNECT
#=========================================================#
# Thunder 3
#=========================================================#
acl thunder_lst url_regex -i "/etc/thunder/thunder.lst"
cache deny thunder_lst
cache_peer 172.16.1.3 parent 8080 0 proxy-only no-digest
dead_peer_timeout 2 seconds
cache_peer_access 172.16.1.3 allow thunder_lst
cache_peer_access 172.16.1.3 deny all
http_access allow manager localhost
http_access allow redeinterna
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
cache_mgr localhost
cache_effective_user squid
cache_effective_group squid
visible_hostname localhost
dns_testnames registro.br
#acl snmppublic snmp_community public
#snmp_access allow snmppublic localhost
#snmp_access deny all
#snmp_incoming_address 0.0.0.0
#snmp_outgoing_address 255.255.255.255
# Configuraçao de LOG
cache_log none
cache_store_log none
# Sem log de acesso
#cache_access_log /var/log/squid/access.log
cache_access_log none
# Setar TOS 8 em pacotes IP de arquivos em cache
zph_mode tos
zph_local 0x08
zph_parent 0
zph_option 136
visible_hostname localhost
cache_mgr localhost
mime_table /etc/squid/mime.conf
pid_filename /var/run/proxy.pid
cache_effective_user squid
cache_effective_group squid
icp_port 0
cache_replacement_policy heap LFUDA
cache_dir aufs /cache/squid/01 20000 256 256
memory_replacement_policy heap GDSF
cache_mem 128 MB
maximum_object_size 256 MB
minimum_object_size 0 KB
maximum_object_size_in_memory 256 KB
cache_swap_low 90
cache_swap_high 95
ipcache_size 1024
fqdncache_size 1024
#
# Configuração proxy estática ------------------------------------------
#
ipcache_low 90
ipcache_high 95
#hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY
mime_table /etc/squid/mime.conf
pid_filename /var/run/proxy.pid
debug_options ALL,1
log_fqdn off
refresh_pattern ^ftp: 15 20% 2280
refresh_pattern ^gopher: 15 0% 2280
refresh_pattern . 15 20% 2280
acl all src 0.0.0.0/0
acl redeinterna src 172.16.0.0/12
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 82
acl Safe_ports port 80 # 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 CONNECT method CONNECT
#=========================================================#
# Thunder 3
#=========================================================#
acl thunder_lst url_regex -i "/etc/thunder/thunder.lst"
cache deny thunder_lst
cache_peer 172.16.1.3 parent 8080 0 proxy-only no-digest
dead_peer_timeout 2 seconds
cache_peer_access 172.16.1.3 allow thunder_lst
cache_peer_access 172.16.1.3 deny all
http_access allow manager localhost
http_access allow redeinterna
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
cache_mgr localhost
cache_effective_user squid
cache_effective_group squid
visible_hostname localhost
dns_testnames registro.br
#acl snmppublic snmp_community public
#snmp_access allow snmppublic localhost
#snmp_access deny all
#snmp_incoming_address 0.0.0.0
#snmp_outgoing_address 255.255.255.255
# Configuraçao de LOG
cache_log none
cache_store_log none
# Sem log de acesso
#cache_access_log /var/log/squid/access.log
cache_access_log none
# Setar TOS 8 em pacotes IP de arquivos em cache
zph_mode tos
zph_local 0x08
zph_parent 0
zph_option 136
visible_hostname localhost
cache_mgr localhost
mime_table /etc/squid/mime.conf
pid_filename /var/run/proxy.pid
cache_effective_user squid
cache_effective_group squid
Altere o IP 172.16.0.3 para o IP do seu servidor proxy cache.