Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Ubuntu Version tested for 12.10
- #!/bin/bash
- clear
- echo "|=====================================================================|"
- echo ""
- echo " _ __ __ _____ "
- echo " | | | \/ |/ ____|"
- echo " | | ___ ___| \ / | | __ "
- echo " _ | |/ _ \ / _ \ |\/| | | |_ |"
- echo " | |__| | (_) | __/ | | | |__| |"
- echo " \____/ \___/ \___|_| |_|\_____|"
- echo ""
- echo "+=====================================================================+"
- echo "| INSTALLATION Raptor 1.0b - Squid 3.x |"
- echo "| 64 bits |"
- echo "+=====================================================================+"
- echo ""
- V='|-------------------------> Version 64 bits <-------------------------|'
- ER='ERROR, Your Linux version is not 64 bits'
- ER2='Use the appropriate script for your version'
- P=`uname -m`
- if [ $P = x86_64 ] ; then
- echo $V
- else
- echo $ER
- echo ""
- echo $ER2
- echo ""
- exit 0
- fi
- echo ""
- IPSERV=$(ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
- HOST_NAME=$(hostname -a) DOMAIN_NAME=$(hostname -d)
- sleep 2
- apt-get update
- cd ..
- mkdir /cache-1; chmod 777 /cache-1; chown proxy:proxy /cache-1; cd /root
- echo Y | apt-get install squid3 squidclient squid-cgi ccze
- sleep 3
- touch /etc/squid3/denegados.lst
- echo "cracks.st" >> /etc/squid3/denegados.lst
- rm -rf /etc/squid3/squid.conf
- touch /etc/squid3/squid.conf
- echo "#========================== Squid 3.x Conf ===========================#
- # Port Option SQUID 3.x
- #----------------------------------------------------------------------
- http_port 3128 intercept
- visible_hostname $DOMAIN_NAME
- icp_port 0
- #----------------------------------------------------------------------
- error_directory /usr/share/squid3/errors/English
- #----------------------------------------------------------------------
- acl denegados url_regex -i "/etc/squid3/denegados.lst"
- #----------------------------------------------------------------------
- # DNS Option
- #----------------------------------------------------------------------
- dns_nameservers 8.8.8.8 8.8.4.4
- dns_retransmit_interval 5 seconds
- dns_timeout 2 minutes
- #----------------------------------------------------------------------
- acl manager proto cache_object
- acl localhost src 127.0.0.1/32 ::1
- acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
- acl CONNECT method CONNECT
- ####################################################################
- 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 Safe_ports port 21 70 80 210 280 443 488 563 591 631 777 901 81 3128 1025-65535
- acl SSL_ports port 443 563 81
- http_access allow manager localhost
- http_access deny manager all
- http_access deny !Safe_ports
- http_access deny CONNECT !SSL_ports
- http_access allow localhost
- http_access deny denegados
- # Always allow localhost connections
- http_access allow localhost
- # Allow local network(s) on interface(s)
- http_access allow localnet
- # Default block all to be sure
- http_access deny all
- #----------------------------------------------------------------------
- coredump_dir /cache-1
- #----------------------------------------------------------------------
- # Reserved memory for cache
- # It is recommended that you take approx. 5 MB of RAM per 1GB assigned to cache_dir
- #----------------------------------------------------------------------
- cache_mem 45 MB
- #----------------------------------------------------------------------
- # Maximum size of a file in cache memory
- #----------------------------------------------------------------------
- maximum_object_size_in_memory 128 KB
- #----------------------------------------------------------------------
- # Maximum and minimum size of files in the disk cache
- #----------------------------------------------------------------------
- maximum_object_size 30 MB
- minimum_object_size 4 KB
- #----------------------------------------------------------------------
- # Replace cache files when disk cache reach 96% full
- #----------------------------------------------------------------------
- cache_swap_low 92
- cache_swap_high 96
- #----------------------------------------------------------------------
- # Total HD space to be used by the cache, number of folders,
- # Number of subfolders in cache
- # 15000 = 15 GB
- #----------------------------------------------------------------------
- cache_dir aufs /cache-1 15000 16 256
- #----------------------------------------------------------------------
- # Standard update cache
- # 1 month = 10080 mins, 1 day = 1440 mins
- #----------------------------------------------------------------------
- refresh_pattern -i \.jpg$ 14400 80% 43200 reload-into-ims
- refresh_pattern -i \.gif$ 14400 80% 43200 reload-into-ims
- refresh_pattern -i \.png$ 14400 80% 43200 reload-into-ims
- refresh_pattern -i \.jpeg$ 14400 80% 43200 reload-into-ims
- refresh_pattern -i \.bmp$ 14400 80% 43200 reload-into-ims
- refresh_pattern -i \.tif$ 14400 80% 43200 reload-into-ims
- refresh_pattern -i \.tiff$ 14400 80% 43200 reload-into-ims
- refresh_pattern -i \.swf$ 14400 80% 43200 reload-into-ims
- refresh_pattern -i \.html$ 10 20% 4320 reload-into-ims
- refresh_pattern -i \.htm$ 10 20% 4320 reload-into-ims
- refresh_pattern -i \.shtml$ 10 20% 4320 reload-into-ims
- refresh_pattern -i \.shtm$ 10 20% 4320 reload-into-ims
- refresh_pattern -i \.nub$ 2880 80% 21600 reload-into-ims
- refresh_pattern -i \.exe$ 14400 80% 43200
- refresh_pattern -i \.zip$ 14400 80% 43200
- refresh_pattern -i \.mov$ 14400 80% 43200
- refresh_pattern -i \.mpe?g?$ 14400 80% 43200
- refresh_pattern -i \.avi$ 14400 80% 43200
- refresh_pattern -i \.qtm?$ 14400 80% 43200
- refresh_pattern -i \.viv$ 14400 80% 43200
- refresh_pattern -i \.wav$ 14400 80% 43200
- refresh_pattern -i \.aiff?$ 14400 80% 43200
- refresh_pattern -i \.au$ 14400 80% 43200
- refresh_pattern -i \.ram?$ 14400 80% 43200
- refresh_pattern -i \.snd$ 14400 80% 43200
- refresh_pattern -i \.mid$ 14400 80% 43200
- refresh_pattern -i \.mp2$ 14400 80% 43200
- refresh_pattern -i \.mp3$ 14400 80% 43200
- refresh_pattern -i \.sit$ 14400 80% 43200
- refresh_pattern -i \.zip$ 14400 80% 43200
- refresh_pattern -i \.hqx$ 14400 80% 43200
- refresh_pattern -i \.arj$ 14400 80% 43200
- refresh_pattern -i \.lzh$ 14400 80% 43200
- refresh_pattern -i \.lha$ 14400 80% 43200
- refresh_pattern -i \.cab$ 14400 80% 43200
- refresh_pattern -i \.rar$ 14400 80% 43200
- refresh_pattern -i \.tar$ 14400 80% 43200
- refresh_pattern -i \.gz$ 14400 80% 43200
- refresh_pattern -i \.z$ 14400 80% 43200
- refresh_pattern -i \.a[0-9][0-9]$ 14400 80% 43200
- refresh_pattern -i \.r[0-9][0-9]$ 14400 80% 43200
- refresh_pattern -i \.txt$ 14400 80% 43200
- refresh_pattern -i \.pdf$ 14400 80% 43200
- refresh_pattern -i \.doc$ 14400 80% 43200
- refresh_pattern -i \.rtf$ 14400 80% 43200
- refresh_pattern -i \.tex$ 14400 80% 43200
- refresh_pattern -i \.latex$ 14400 80% 43200
- refresh_pattern -i \.class$ 14400 80% 43200
- refresh_pattern -i \.js$ 14400 80% 43200
- refresh_pattern -i \.ico$ 14400 80% 43200
- refresh_pattern -i \.css$ 10 20% 4320
- #----------------------------------------------------------------------
- refresh_pattern ^ftp: 1440 20% 10080
- refresh_pattern ^gopher: 1440 0% 1440
- refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
- #refresh_pattern (Release|Package(.gz)*)$ 0 20% 2880
- refresh_pattern . 0 20% 4320
- #----------------------------------------------------------------------
- # Access log for the cache or to SARG
- #----------------------------------------------------------------------
- logfile_rotate 1
- access_log /var/log/squid3/access.log
- access_log /var/log/squid3/error.log
- cache_store_log none
- #----------------------------------------------------------------------
- # other configurations
- #----------------------------------------------------------------------
- half_closed_clients off
- server_persistent_connections off
- client_persistent_connections off
- log_fqdn off
- quick_abort_min 0 KB
- quick_abort_max 0 KB
- quick_abort_pct 100
- max_filedescriptors 65536
- cache_effective_user proxy
- cache_effective_group proxy
- #----------------------------------------------------------------------
- # Keeping small objects in recent memory
- #----------------------------------------------------------------------
- memory_replacement_policy heap GDSF
- cache_replacement_policy heap LFUDA
- #----------------------------------------------------------------------
- # Sites that are denied to store files in squid cache
- #----------------------------------------------------------------------
- acl nocache dstdomain .4shared.com .youtube.com .windowsupdate.com .gl$
- no_cache deny nocache
- #----------------------------------------------------------------------
- # Denying cache for files with extension. Asx and. Asf | streaming |
- #----------------------------------------------------------------------
- acl asx url_regex -i \.asx$
- cache deny asx
- acl asf url_regex -i \.asf$
- cache deny asf" >> /etc/squid3/squid.conf
- /etc/init.d/squid3 stop
- sleep 1
- squid3 -z
- sleep 1
- /etc/init.d/squid3 restart
- sleep 6
- IPSERV=$(ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
- HOST_NAME=$(hostname -a) DOMAIN_NAME=$(hostname -d)
- echo Y | apt-get install apache2
- sleep 1
- echo Y | apt-get install sqlite gcc libsqlite3-dev libapache2-mod-php5 php-db libstdc++6 g++ unzip
- echo Y | apt-get install libmysqlclient15-dev libblkid-dev libcurl3-dev lynx ffmpeg lsb-release sudo
- echo Y | apt-get install make php5-dev php-pear apache2-prefork-dev libpcre3-dev
- sleep 3
- wget http://www.raptorcache.com/install/64/raptor64.tar.gz
- cp raptor64.tar.gz /tmp
- tar -xzvf /tmp/raptor64.tar.gz -C /
- rm -rf raptor64.tar.gz
- chmod a+x /usr/sbin/raptor
- mkdir /var/log/raptor && mkdir /var/tmp/raptor && mkdir /var/run/raptor && mkdir /raptorcache &&
- chmod a+rwx /var/log/raptor && chmod a+rwx /var/tmp/raptor && chmod a+rwx /var/run/raptor && chmod a+x /etc/init.d/raptor &&
- chown -R www-data /raptorcache/
- chmod -R 777 /raptorcache/
- umask 000 /raptorcache/
- echo "extension=pdo.so" >> /etc/php5/apache2/php.ini
- echo "vm.swappiness=10" >> /etc/sysctl.conf
- update-rc.d raptor defaults
- sleep 3
- echo "#----------------------------------------------------------------------
- acl raptor_lst url_regex -i \"/etc/raptor/raptor.lst\"
- cache deny raptor_lst
- cache_peer $IPSERV parent 8080 0 proxy-only no-digest
- dead_peer_timeout 2 seconds
- cache_peer_access $IPSERV allow raptor_lst
- cache_peer_access $IPSERV deny all
- #----------------------------------------------------------------------" >> /etc/squid3/squid.conf
- sleep 3
- wget http://www.raptorcache.com/install/clean/64/clean.zip
- unzip clean.zip
- mv clean /etc/raptor/
- chmod 777 /etc/raptor/clean
- rm -rf clean.zip
- wget http://www.raptorcache.com/install/var/pluginmaker.tar.gz
- tar -xzvf pluginmaker.tar.gz
- mv pluginmaker /etc/raptor/
- rm -rf pluginmaker.tar.gz
- touch /etc/raptor/raptor.lst
- wget http://www.raptorcache.com/install/64/plugins/plugins.tar.gz
- tar -xzvf plugins.tar.gz
- mv plugins /etc/raptor/
- rm -rf plugins.tar.gz
- clear
- chmod 777 /etc/raptor/plugins/*
- chmod 777 /etc/raptor/cl0
- # wget -O /usr/lib64/libmysqlclient.so.16 http://www.joemg.host56.com/lib/64bits/libmysqlclient.so.16
- wget -O /usr/lib/libmysqlclient.so.16 http://www.joemg.host56.com/lib/64bits/libmysqlclient.so.16
- wget http://repo.undip.ac.id/ubuntu//pool/main/m/mysql-5.1/libmysqlclient16_5.1.67-0ubuntu0.11.10.1_amd64.deb
- dpkg -i libmysqlclient16_5.1.67-0ubuntu0.11.10.1_amd64.deb
- /etc/init.d/raptor start
- chmod 777 /etc/raptor/clean
- sleep 3
- ## Raptor
- # m h dom mon dow user command
- 59 1 * * * root /etc/raptor/./clean 45
- 30 23 * * * root squid3 -k rotate
- * */1 * * * root /etc/raptor/./cl0
- 59 22 * * * root /etc/raptor/rprotate
- */2 * * * * root serv
- */1 * * * * root vnstat -u -i eth0
- sleep 6
- #-------------------------------------------------------------------------------------------
- apt-get update
- clear
- echo ""
- echo ""
- echo "+-------------------------------------------------------------+"
- echo "| Installing Mysql |"
- echo "| It is important to set the password of Mysql = raptor |"
- echo "+-------------------------------------------------------------+"
- echo Press enter to continue...
- read -n 0 -ers
- echo Y | apt-get install mysql-server mysql-client php5-mysql &&
- echo Y | aptitude install php5-cgi &&
- echo Y | apt-get -f upgrade &&
- wget http://www.raptorcache.com/install/var/raptor.sql
- cp raptor.sql /var/tmp/
- rm -rf raptor.sql
- echo
- mysql -u root -praptor << eof
- CREATE DATABASE raptor;
- eof
- mysql -u root -praptor raptor < /var/tmp/raptor.sql
- sleep 6
- IPSERV=$(ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
- HOST_NAME=$(hostname -a) DOMAIN_NAME=$(hostname -d)
- sleep 3
- mv /etc/hosts /etc/hosts_
- touch /etc/hosts
- echo "127.0.0.1 localhost.localdomain localhost
- $IPSERV $HOST_NAME.$DOMAIN_NAME $HOST_NAME
- #
- ::1 localhost ip6-localhost ip6-loopback
- fe00::0 ip6-localnet
- fe00::0 ip6-mcastprefix
- ff02:1 ip6-allnodes
- ff02::2 ip6-allrouters
- ff02::3 ip6-allhosts" >> /etc/hosts
- sleep 3
- # mv /etc/hostname /etc/hostname_
- # touch /etc/hostname
- # echo "proxy.$HOST_NAME" >> /etc/hostname
- # mv /etc/resolv.conf /etc/resolv.conf_
- # mv /etc/resolv.conf /etc/resolv.conf_
- # touch /etc/resolv.conf
- # echo "search proxy.$HOST_NAME
- # nameserver 127.0.0.1
- # nameserver 8.8.8.8
- # nameserver 8.8.4.4" >> /etc/resolv.conf
- mv /etc/network/interfaces /etc/network/interfaces_
- sed '/dns-nameservers/d' /etc/network/interfaces_ > /etc/network/interfaces
- echo "dns-nameservers 127.0.0.1 8.8.8.8 8.8.4.4" >> /etc/network/interfaces
- sleep 3
- echo Y | apt-get install bind9 dnsutils bind9-doc
- sleep 3
- mv /etc/bind/named.conf.options /etc/bind/named.conf.options_old
- touch /etc/bind/named.conf.options
- echo "options {
- directory "/var/cache/bind";
- forward only;
- forwarders { 8.8.8.8; 8.8.4.4; };
- auth-nxdomain no; # conform to RFC1035
- listen-on-v6 { yes; };
- listen-on { 127.0.0.1; };
- version none;
- };" >> /etc/bind/named.conf.options
- echo "include "/etc/bind/zones.rfc1918";
- };" >> /etc/bind/named.conf.local
- echo "ServerName $HOST_NAME.$DOMAIN_NAME" >> /etc/apache2/apache2.conf
- mv /etc/apache2/httpd.conf /etc/apache2/httpd.conf_
- mkdir /etc/cacti
- touch /etc/cacti/httpd.conf
- echo "Listen 82
- <VirtualHost *:82>
- DocumentRoot /var/raptor
- ServerName www.raptorcache.com
- ErrorLog /var/log/virtual82-error_log
- CustomLog /var/log/virtual82-access_log common
- </VirtualHost>
- Listen 84
- <VirtualHost *:84>
- DocumentRoot /var/www/sarg
- ServerName www.raptorcache.com
- </VirtualHost>" >> /etc/apache2/httpd.conf
- sleep 6
- clear
- sleep 3
- echo "
- # Repository Sarg for debian
- # deb http://backports.debian.org/debian-backports squeeze-backports main" >> /etc/apt/sources.list
- apt-get update
- echo Y | aptitude install sarg
- mv /etc/sarg/sarg.conf /etc/sarg/sarg.conf_old
- wget http://www.raptorcache.com/install/var/sarg.conf
- mv sarg.conf /etc/sarg/sarg.conf
- echo "
- # Schedulle of Sarg
- 59 21 * * * root sarg" >> /etc/crontab
- mkdir /var/www/sarg/
- sarg
- sleep 1
- wget http://joemg.host56.com/wpanel/raptor.tar.gz
- tar -xzvf raptor.tar.gz
- mv raptor /var/
- rm -rf raptor.tar.gz
- clear
- chmod 777 /var/raptor/*
- chmod 777 /var/raptor/mail/*
- chmod 777 /etc/raptor/raptor.lst
- chmod 777 /etc/squid3/squid.conf
- chmod 777 /etc/raptor/raptor.conf
- chmod 777 /etc/squid3/denegados.lst
- chmod 777 /etc/network/interfaces
- chmod 777 /etc/resolv.conf
- clear
- sleep 1
- echo Y | apt-get install snmpd
- mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.old
- touch /etc/snmp/snmpd.conf
- echo 'rocommunity public
- syslocation "PDC, Proxy DataCenter"
- syscontact [email protected]' > /etc/snmp/snmpd.conf
- rm -rf /etc/default/snmpd
- wget http://www.raptorcache.com/install/var/snmpd
- mv snmpd /etc/default/
- /etc/init.d/snmpd restart
- sleep 3
- clear
- echo ""
- echo ""
- echo "+--------------------------------------------------------------------------------------+"
- echo "| Installing Cacti |"
- echo "| Choose Apache2 as web server and then enter the password Mysql(raptor) |"
- echo "+--------------------------------------------------------------------------------------+"
- echo Press enter to continue...
- read -n 0 -ers
- echo Y | apt-get install cacti
- wget http://www.raptorcache.com/install/var/raptor-cacti.sql
- mv raptor-cacti.sql /var/tmp/
- mysql -u root -praptor cacti < /var/tmp/raptor-cacti.sql
- sleep 1
- mv /etc/cacti/apache.conf /etc/cacti/apache.conf_
- touch /etc/cacti/apache.conf
- echo "Alias /graphcacti /usr/share/cacti/site
- <Directory /usr/share/cacti/site>
- Options +FollowSymLinks
- AllowOverride None
- order allow,deny
- allow from all
- AddType application/x-httpd-php .php
- <IfModule mod_php5.c>
- php_flag magic_quotes_gpc Off
- php_flag short_open_tag On
- php_flag register_globals Off
- php_flag register_argc_argv On
- php_flag track_vars On
- # this setting is necessary for some locales
- php_value mbstring.func_overload 0
- php_value include_path .
- </IfModule>
- DirectoryIndex index.php
- </Directory>" >> /etc/cacti/apache.conf
- /etc/init.d/apache2 restart
- echo Y | apt-get install vnstat
- vnstat -u -i eth0
- echo Y | apt-get install smartmontools lvm2 hdparm
- sleep 1
- echo Y | apt-get install lm-sensors
- clear
- echo ""
- echo ""
- echo "+---------------------------------------------+"
- echo "| temperature sensors Installation |"
- echo "+---------------------------------------------+"
- echo Press enter to continue...
- read -n 0 -ers
- sensors-detect
- service module-init-tools restart
- /etc/init.d/module-init-tools restart
- echo "
- # DNS Cache
- */2 * * * * root rndc dumpdb" >> /etc/crontab
- clear
- wget http://www.raptorcache.com/install/var/upload.cgi
- mv upload.cgi /usr/lib/cgi-bin/
- chmod 777 /usr/lib/cgi-bin/upload.cgi
- echo Y | apt-get --purge remove sudo
- echo Y | apt-get install sudo
- echo "www-data ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
- chmod 777/etc/sudoers
- clear
- echo | pecl install apc --with-apxs='/usr/bin/apxs2'
- echo "Alias /var/raptor/apc /usr/share/php/apc.php
- <Directory /usr/share/php/apc.php>
- Options +FollowSymLinks
- AllowOverride None
- order allow,deny
- allow from all
- AddType application/x-httpd-php .php
- <IfModule mod_php5.c>
- php_flag magic_quotes_gpc Off
- php_flag short_open_tag On
- php_flag register_globals Off
- php_flag register_argc_argv On
- php_flag track_vars On
- # this setting is necessary for some locales
- php_value mbstring.func_overload 0
- php_value include_path .
- </IfModule>
- DirectoryIndex index.php
- </Directory>" >> /etc/apache2/conf.d/apc.conf
- echo "extension=apc.so" >> /etc/php5/conf.d/apc.ini
- echo "; APC Configuration
- apc.enabled = 1
- ; Memory allocated to APC. Use Munin or APC Info to see if more is needed.
- apc.shm_size=32M
- ; rfc1867 allow file upload progression display.
- apc.rfc1867 = on" >> /etc/php5/conf.d/apc-config.ini
- clear
- rm -rf /var/tmp/*
- rm -rf web.zip
- echo ""
- echo ""
- echo ""
- echo ""
- echo "+==========================================================================+"
- echo "| |"
- echo "| Installation Complete |"
- echo "| |"
- echo "| Reboot your system to complete the installation |"
- echo "| |"
- echo "+==========================================================================+"
- echo ""
- echo ""
Advertisement
Add Comment
Please, Sign In to add comment