View difference between Paste ID: dceU3NQJ and wUc0vk6J
SHOW: | | - or go back to the newest paste.
1-
# bash raptor10b-r001.sh
1+
# Ubuntu Version tested on 12.10
2-
# Installation squid 3 with raptorcache by JoeMG
2+
# wget http://www.raptorcache.com/install/raptor10b-64.sh
3-
# All in One script for Ubuntu and Debian by Wandi - Iamspa ( members of FMI )
3+
# chmod 777 raptor10b-64.sh 
4
# Edit and replace with script below
5
# bash raptor10b-64.sh
6-
echo "+===============================================================================+"
6+
7-
echo "|         Installation squid 3 with raptorcache by Joel Maguina ( JoeMG )       |"
7+
8-
echo "| Script Revision 001 by wandi - iamspa ( members of Forum Mikrotik Indonesia ) |"
8+
echo "|=====================================================================|"
9-
echo "|                 ONLY FOR APT_BASED LINUX  ( Debian or Ubuntu )                |"
9+
10-
echo "+===============================================================================+"
10+
echo "       _            __  __  _____ "
11-
echo "IF YOU DON'T USE DEBIAN OR UBUNTU,"
11+
echo "      | |          |  \/  |/ ____|"
12-
echo "Please CLOSE INSTALLATION by pressing Ctrl+c"
12+
echo "      | | ___   ___| \  / | |  __ "
13
echo "  _   | |/ _ \ / _ \ |\/| | | |_ |"
14-
echo press Enter to continue with this installation script ...
14+
echo " | |__| | (_) |  __/ |  | | |__| |"
15
echo "  \____/ \___/ \___|_|  |_|\_____|"
16
echo ""
17-
#===============================================================================
17+
echo "+=====================================================================+"
18-
# Shell script which detects the Linux distro and add repository
18+
echo "|              INSTALLATION Raptor 1.0b - Squid 3.x                   |"
19-
#===============================================================================
19+
echo "|                              64 bits                                |"
20-
detectedDistro="Unknown"
20+
echo "+=====================================================================+"
21-
regExpLsbInfo="Description:[[:space:]]*([^ ]*)"
21+
22-
regExpLsbFile="/etc/(.*)[-_]"
22+
V='|-------------------------> Version 64 bits <-------------------------|'
23
ER='ERROR, Your Linux version is not 64 bits' 
24-
if [ `which lsb_release 2>/dev/null` ]; then       # lsb_release available
24+
ER2='Use the appropriate script for your version'
25-
   lsbInfo=`lsb_release -d`
25+
26-
   if [[ $lsbInfo =~ $regExpLsbInfo ]]; then
26+
27-
      detectedDistro=${BASH_REMATCH[1]}
27+
   echo $V
28-
   else
28+
else
29-
      echo "??? Should not occur: Don't find distro name in lsb_release output ???"
29+
   echo $ER
30-
      exit 1
30+
31-
   fi
31+
   echo $ER2
32
echo ""
33-
else                                               # lsb_release not available
33+
exit 0
34-
   etcFiles=`ls /etc/*[-_]{release,version} 2>/dev/null`
34+
35-
   for file in $etcFiles; do
35+
36-
      if [[ $file =~ $regExpLsbFile ]]; then
36+
37-
         detectedDistro=${BASH_REMATCH[1]}
37+
38-
         break
38+
HOST_NAME="local.war.net"					
39-
      else
39+
40-
         echo "??? Should not occur: Don't find any etcFiles ???"
40+
41-
         exit 1
41+
42-
      fi
42+
apt-get update
43-
   done
43+
44
cd ..
45
mkdir /cache-1
46-
detectedDistro=`echo $detectedDistro | tr "[:upper:]" "[:lower:]"`
46+
chmod 777 /cache-1
47
cd /root
48-
case $detectedDistro in
48+
49-
	suse) 	detectedDistro="opensuse" ;;
49+
echo Y | apt-get install squid3 
50-
        linux)	detectedDistro="linuxmint" ;;
50+
51-
esac
51+
52
touch /etc/squid3/denegados.lst
53-
if [ $detectedDistro = debian ] ; then
53+
54-
	# Please change to better repository or your local repository
54+
55-
	echo deb http://kambing.ui.ac.id/debian/ squeeze main | tee -a /etc/apt/sources.list
55+
rm -rf /etc/squid3/squid.conf 
56-
	echo deb-src http://kambing.ui.ac.id/debian/ squeeze main | tee -a /etc/apt/sources.list
56+
57-
	echo deb http://kambing.ui.ac.id/debian/ squeeze-updates main | tee -a /etc/apt/sources.list
57+
58-
	echo deb-src http://kambing.ui.ac.id/debian/ squeeze-updates main | tee -a /etc/apt/sources.list
58+
59-
	echo deb http://backports.debian.org/debian-backports squeeze-backports main | tee -a /etc/apt/sources.list
59+
60-
	apt-get update
60+
61-
	apt-get -y install mysql-common libmysqlclient16 
61+
62-
elif [ $detectedDistro = ubuntu ] ; then
62+
visible_hostname proxy.$HOST_NAME
63
icp_port 0
64-
	P=`uname -m`
64+
65
error_directory /usr/share/squid3/errors/English
66-
	apt-get update && apt-get -y install mysql-common 
66+
67-
	wget http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.1/libmysqlclient16_5.1.67-0ubuntu0.11.10.1_amd64.deb
67+
68-
	dpkg -i libmysqlclient16_5.1.67-0ubuntu0.11.10.1_amd64.deb
68+
69-
	
69+
70-
elif [ $P = i386 ] ; then	
70+
71-
	apt-get update && apt-get -y install mysql-common
71+
72-
	wget hhttp://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.1/libmysqlclient16_5.1.67-0ubuntu0.11.10.1_i386.deb
72+
73-
	dpkg -i libmysqlclient16_5.1.67-0ubuntu0.11.10.1_i386.deb
73+
74
#----------------------------------------------------------------------
75
acl manager proto cache_object
76-
# Tested on centos, debian and ubuntu
76+
77-
# else if not detectedDistro not debian or ubuntu then EXIT
77+
78-
else 
78+
79-
	exit 0
79+
80
acl Safe_ports port 80          # http
81
acl Safe_ports port 21          # ftp
82
acl SSL_ports port 443
83-
#===============================================================================
83+
acl Safe_ports port 443         # https
84-
#                          Optimizing Server Performance
84+
acl Safe_ports port 70          # gopher
85-
#===============================================================================
85+
acl Safe_ports port 210         # wais
86
acl Safe_ports port 1025-65535  # unregistered ports
87-
echo 4 >> /proc/sys/net/ipv4/tcp_fin_timeout
87+
acl Safe_ports port 280         # http-mgmt
88-
mv /etc/sysctl.conf /etc/sysctl.conf_
88+
acl Safe_ports port 488         # gss-http
89-
touch /etc/sysctl.conf
89+
acl Safe_ports port 591         # filemaker
90
acl Safe_ports port 777         # multiling http
91
acl Safe_ports port 631         # cups
92-
vm.swappiness = 10" >> /etc/sysctl.conf
92+
acl Safe_ports port 873         # rsync
93
acl Safe_ports port 901         # SWAT
94-
echo 65536 > /proc/sys/fs/file-max
94+
acl Safe_ports port 1863        # MSN
95-
echo "*         soft        nofile          65536" >> /etc/security/limits.conf
95+
#acl SSL_ports port 443          # https
96-
echo "*         hard        nofile          65536" >> /etc/security/limits.conf
96+
acl SSL_ports port 563          # snews
97-
echo "root      soft        nofile          65536" >> /etc/security/limits.conf
97+
acl SSL_ports port 873          # rsync
98-
echo "root      hard        nofile          65536" >> /etc/security/limits.conf
98+
99-
echo "proxy     soft        nofile          65536" >> /etc/security/limits.conf
99+
100-
echo "proxy     hard        nofile          65536" >> /etc/security/limits.conf
100+
101-
echo "session required        pam_limits.so" >> /etc/pam.d/common-session
101+
102-
modprobe ip_tables
102+
103-
modprobe ip_conntrack
103+
104-
modprobe ip_conntrack_ftp
104+
105-
modprobe ip_conntrack_irc
105+
106-
modprobe iptable_nat
106+
coredump_dir /cache-1
107-
modprobe ip_nat_ftp
107+
108
# Reserved memory for cache
109-
echo "ip_conntrack
109+
110-
ip_tables
110+
111-
ip_conntrack_ftp
111+
cache_mem 50 MB
112-
ip_conntrack_irc
112+
113-
iptable_nat
113+
114-
ip_nat_ftp">> /etc/modules
114+
115
maximum_object_size_in_memory 128 KB
116-
echo "ulimit -Hn 65536
116+
117-
ulimit -Sn 65535">> /etc/profile
117+
118-
#===============================================================================
118+
119-
# Install Squid 3 with 1 Cache ( /cache-1 )
119+
120-
#===============================================================================
120+
121
#----------------------------------------------------------------------
122
# Replace cache files when disk cache reach 96% full
123-
HOST_NAME=$(hostname -a) 
123+
124-
DOMAIN_NAME=$(hostname -d)	                                      
124+
125
cache_swap_high 96
126-
sleep 2
126+
127
# Total HD space to be used by the cache, number of folders,
128-
mkdir /cache-1 && chmod 777 /cache-1 && chown proxy:proxy /cache-1
128+
129
# 10000 = 10 GB
130-
echo Y | apt-get install squid3 ccze
130+
131
cache_dir aufs /cache-1 10000  16 256
132
#----------------------------------------------------------------------
133
# Standard update cache
134
# 1 month = 10080 mins, 1 day = 1440 mins
135
#----------------------------------------------------------------------
136-
rm -rf /etc/squid3/squid.conf
136+
refresh_pattern -i \.jpg$ 14400 80% 43200 reload-into-ims
137
refresh_pattern -i \.gif$ 14400 80% 43200 reload-into-ims
138
refresh_pattern -i \.png$ 14400 80% 43200 reload-into-ims
139
refresh_pattern -i \.jpeg$ 14400 80% 43200 reload-into-ims
140
refresh_pattern -i \.bmp$ 14400 80% 43200 reload-into-ims
141
refresh_pattern -i \.tif$ 14400 80% 43200 reload-into-ims
142
refresh_pattern -i \.tiff$ 14400 80% 43200 reload-into-ims
143-
visible_hostname www.$DOMAIN_NAME
143+
refresh_pattern -i \.swf$ 14400 80% 43200 reload-into-ims
144
refresh_pattern -i \.html$ 10 20% 4320 reload-into-ims
145
refresh_pattern -i \.htm$ 10 20% 4320 reload-into-ims
146
refresh_pattern -i \.shtml$ 10 20% 4320 reload-into-ims
147
refresh_pattern -i \.shtm$ 10 20% 4320 reload-into-ims
148
refresh_pattern -i \.nub$ 2880 80% 21600 reload-into-ims
149
refresh_pattern -i \.exe$ 14400 80% 43200
150
refresh_pattern -i \.zip$ 14400 80% 43200
151
refresh_pattern -i \.mov$ 14400 80% 43200
152
refresh_pattern -i \.mpe?g?$ 14400 80% 43200
153
refresh_pattern -i \.avi$ 14400 80% 43200
154
refresh_pattern -i \.qtm?$ 14400 80% 43200
155
refresh_pattern -i \.viv$ 14400 80% 43200
156
refresh_pattern -i \.wav$ 14400 80% 43200
157
refresh_pattern -i \.aiff?$ 14400 80% 43200
158
refresh_pattern -i \.au$ 14400 80% 43200
159
refresh_pattern -i \.ram?$ 14400 80% 43200
160
refresh_pattern -i \.snd$ 14400 80% 43200
161-
# acl localnet src 10.0.0.0/8     # RFC1918 possible internal network
161+
refresh_pattern -i \.mid$ 14400 80% 43200
162-
# acl localnet src 172.16.0.0/12  # RFC1918 possible internal network
162+
refresh_pattern -i \.mp2$ 14400 80% 43200
163-
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
163+
refresh_pattern -i \.mp3$ 14400 80% 43200
164
refresh_pattern -i \.sit$ 14400 80% 43200
165-
acl Safe_ports port 21 70 80 210 280 443 488 563 591 631 777 901 81 3128 1025-65535
165+
refresh_pattern -i \.zip$ 14400 80% 43200
166-
acl SSL_ports port 443 563 81
166+
refresh_pattern -i \.hqx$ 14400 80% 43200
167
refresh_pattern -i \.arj$ 14400 80% 43200
168
refresh_pattern -i \.lzh$ 14400 80% 43200
169
refresh_pattern -i \.lha$ 14400 80% 43200
170
refresh_pattern -i \.cab$ 14400 80% 43200
171
refresh_pattern -i \.rar$ 14400 80% 43200
172
refresh_pattern -i \.tar$ 14400 80% 43200
173
refresh_pattern -i \.gz$ 14400 80% 43200
174-
# Always allow localhost connections
174+
refresh_pattern -i \.z$ 14400 80% 43200
175
refresh_pattern -i \.a[0-9][0-9]$ 14400 80% 43200
176-
# Allow local network(s) on interface(s)
176+
177-
http_access allow localnet 
177+
refresh_pattern -i \.txt$ 14400 80% 43200
178-
# Default block all to be sure
178+
refresh_pattern -i \.pdf$ 14400 80% 43200
179-
http_access deny all
179+
refresh_pattern -i \.doc$ 14400 80% 43200
180-
# always_direct allow all
180+
refresh_pattern -i \.rtf$ 14400 80% 43200
181
refresh_pattern -i \.tex$ 14400 80% 43200
182
refresh_pattern -i \.latex$ 14400 80% 43200
183-
coredump_dir /var/spool/squid3
183+
refresh_pattern -i \.class$ 14400 80% 43200
184
refresh_pattern -i \.js$ 14400 80% 43200
185
refresh_pattern -i \.ico$ 14400 80% 43200
186
refresh_pattern -i \.css$ 10 20% 4320
187
#----------------------------------------------------------------------
188-
cache_mem 125 MB
188+
189
refresh_pattern ^gopher:        1440    0%      1440
190
refresh_pattern -i (/cgi-bin/|\?) 0     0%      0
191
#refresh_pattern (Release|Package(.gz)*)$       0       20%     2880
192
refresh_pattern .               0       20%     4320
193
#----------------------------------------------------------------------
194
# Access log for the cache or to SARG
195
#----------------------------------------------------------------------
196
logfile_rotate 1
197
access_log /var/log/squid3/access.log
198
access_log /var/log/squid3/error.log
199
cache_store_log none
200
#----------------------------------------------------------------------
201
# other configurations
202
#----------------------------------------------------------------------
203
half_closed_clients off
204
server_persistent_connections off
205
client_persistent_connections off
206-
# 25000 = 25 GB
206+
207
quick_abort_min 0 KB
208-
cache_dir aufs /cache-1 25000	25	256
208+
209
quick_abort_pct 100
210
max_filedescriptors 65536
211
cache_effective_user proxy
212
cache_effective_group proxy
213-
refresh_pattern -i .(gif|png|jp?g|ico|bmp|tiff?)$ 14400 80% 43200 reload-into-ims
213+
214-
refresh_pattern -i .(swf|htm|html|shtm|shtml|nub)$ 14400 80% 43200 reload-into-ims
214+
215-
refresh_pattern -i .(rpm|cab|deb|exe|msi|msu|zip|tar|xz|bz|bz2|lzma|gz|tgz|rar|bin|7z|doc?|xls?|ppt?|pdf|nth|psd|sis)$ 14400 80% 43200
215+
216-
refresh_pattern -i .(avi|iso|wav|mid|mp?|mpe?g?|mpeg|mov|3gp|wm?|flv|x-flv|axd)$ 14400 80% 43200
216+
217-
refresh_pattern -i .(qtm?|viv|au|ram?|snd|sit|hqx|arj|lzh|lha|txt|rtf|tex|latex|class|js|ico)$ 14400 80% 43200
217+
218
#----------------------------------------------------------------------
219
# Sites that are denied to store files in squid cache 
220
#----------------------------------------------------------------------
221
acl nocache dstdomain .4shared.com .youtube.com .windowsupdate.com .gl$
222
no_cache deny nocache
223
#----------------------------------------------------------------------
224
# Denying cache for files with extension. Asx and. Asf | streaming |
225-
refresh_pattern -i (cgi-bin|hackshield|xtrap|Loader|login) 0 0% 0
225+
226-
# refresh_pattern (Release|Package(.gz)*)$       0       20%     2880
226+
acl asx url_regex -i \.asx$
227
cache deny asx
228
acl asf url_regex -i \.asf$
229
cache deny asf" >> /etc/squid3/squid.conf
230
231-
logfile_rotate 2
231+
232
sleep 1
233
234
squid3 -z
235
sleep 1
236
237
/etc/init.d/squid3 restart
238
239
sleep 6
240
241
242
IPSERV=$(ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')		
243
244
sleep 3
245
246
apt-get update
247
248
echo Y | apt-get install apache2
249
250
sleep 1
251
252
echo Y | apt-get install sqlite gcc libsqlite3-dev libapache2-mod-php5 php-db libstdc++6 g++ unzip 
253
254
echo Y | apt-get install libmysqlclient15-dev libblkid-dev libcurl3-dev lynx ffmpeg lsb-release sudo 
255
256-
acl nocachedom dstdomain .4shared.com .cnet.com .globo.com .miniclip.com .popcap.com
256+
echo Y | apt-get install make php5-dev php-pear apache2-prefork-dev libpcre3-dev   
257-
acl nocachedom dstdomain .symantecliveupdate.com .vostucdn.com .5min.com .cramit.in
257+
258-
acl nocachedom dstdomain .goear.com .mlstatic.com .pornhub.com .telaxo.com .wikimedia.org
258+
259-
acl nocachedom dstdomain .movistar.com.pe .pornotube.com .avg.com .dailymotion.com 
259+
cd /root
260-
acl nocachedom dstdomain .terra.com .windowsupdate.com .depositfiles.com .hardsextube.com
260+
261-
acl nocachedom dstdomain .mozilla.net .porntube.com .adobe.com .dungeonbusters.com
261+
262-
acl nocachedom dstdomain .hotfile.com .myspacecdn.com .tricom.net .xtube.com .tetrisfb.com
262+
263-
acl nocachedom dstdomain .wooga.com .akamaihd.net .edgecastcdn.net .hsyns.net .nai.com
263+
wget http://www.raptorcache.com/install/64/raptor64.tar.gz
264-
acl nocachedom dstdomain .redtube.com .triviador.com .xvideos.com .amazonaws.com
264+
cp raptor64.tar.gz /tmp
265-
acl nocachedom dstdomain .eluniverso.com .juegosjuegos.com .netlogstatic.com .redtubefiles.com
265+
tar -xzvf /tmp/raptor64.tar.gz -C /
266-
acl nocachedom dstdomain .tube8.com .yimg.com .appspot.com .eset.com .kixeye.com 
266+
rm -rf raptor64.tar.gz
267-
acl nocachedom dstdomain .netpocket.org .rncdn3.com .ubuntu.com .youjizz.com .softonic.com 
267+
chmod a+x /usr/sbin/raptor
268-
acl nocachedom dstdomain .avast.com .ewinet.com .llnwd.net .nflxvideo.net .fbcdn.net
268+
269-
acl nocachedom dstdomain .sendspace.com .uol.com.br .youporn.com .avira-update.com
269+
270-
acl nocachedom dstdomain .uptodown.net .ytimg.com .viddler.com .zgncdn.com .staticflickr.com 
270+
271-
acl nocachedom dstdomain .videocaserox.com .ziddu.com .video.msn.com .softnyx.com 
271+
272-
acl nocachedom dstdomain .nordeus.com .socialpointgames.com .youtube.com .stream.aol.com 
272+
273-
acl nocachedom dstdomain .axeso5.com .filefactory.com .mbamupdates.com .noticias24.com 
273+
274-
acl nocachedom dstdomain .baycdn.com .filehippo.com .mcafee.com .pandonetworks.com 
274+
275-
acl nocachedom dstdomain .blogspot.com .fileserve.com .mccont.com .phncdn.com .sourceforge.net 
275+
276-
acl nocachedom dstdomain .cam4s.com .fulltono.com .metacafe.com .photobucket.com 
276+
echo "vm.swappiness=10" >> /etc/sysctl.conf
277-
acl nocachedom dstdomain .cloudfront.net .geewa.net .microsoft.com .pop6.com .vimeo.com
277+
278-
acl nocachedom dstdomain .macromedia.com .google.com
278+
279-
no_cache deny nocachedom
279+
280
sleep 3
281-
# Denying cache for files with extension.                              |
281+
282
echo "
283-
acl dontrewrite url_regex -i .(asx|asf)$
283+
284-
acl dontrewrite url_regex (get_video|videoplayback\?id|videoplayback.*id).*begin\=[1-9][0-9]*
284+
285-
acl dontrewrite url_regex \.(php|asp|aspx|jsp|cgi|js)\?
285+
286-
acl dontrewrite url_regex threadless.*\.jpg\?r=
286+
287-
no_cache deny dontrewrite" >> /etc/squid3/squid.conf
287+
288
cache_peer_access $IPSERV allow raptor_lst
289
cache_peer_access $IPSERV deny all
290
#----------------------------------------------------------------------" >> /etc/squid3/squid.conf
291
292
sleep 3
293
 
294
wget http://www.raptorcache.com/install/clean/64/clean.zip 
295
unzip clean.zip 
296
mv clean /etc/raptor/
297-
sleep 3 
297+
298
rm -rf clean.zip
299-
#===============================================================================
299+
300-
# Install Raptorcache
300+
301-
#===============================================================================
301+
302
mv pluginmaker /etc/raptor/
303
rm -rf pluginmaker.tar.gz
304-
HOST_NAME=$(hostname -a) 
304+
305-
DOMAIN_NAME=$(hostname -d)					
305+
306
307
wget http://www.raptorcache.com/install/64/plugins/plugins.tar.gz
308
tar -xzvf plugins.tar.gz
309
mv plugins /etc/raptor/
310
rm -rf plugins.tar.gz
311-
echo Y | apt-get install sqlite gcc libsqlite3-dev libapache2-mod-php5 php-db libstdc++6 g++ unzip libmysqlclient-dev libblkid-dev libcurl4-openssl-dev lynx ffmpeg lsb-release sudo make php5-dev php-pear apache2-prefork-dev libpcre3-dev   
311+
312
chmod 777 /etc/raptor/plugins/*
313
chmod 777 /etc/raptor/cl0
314
315-
#===============================================================================
315+
wget -O /usr/lib/libmysqlclient.so.16 http://www.joemg.host56.com/lib/64bits/libmysqlclient.so.16
316-
# Detect Arch for RaptorCache Installation
316+
317-
#===============================================================================
317+
wget http://repo.undip.ac.id/ubuntu//pool/main/m/mysql-5.1/libmysqlclient16_5.1.67-0ubuntu0.11.10.1_amd64.deb
318
319
dpkg -i libmysqlclient16_5.1.67-0ubuntu0.11.10.1_amd64.deb
320
321-
	wget -O /usr/lib/libmysqlclient.so.16 http://www.joemg.host56.com/lib/64bits/libmysqlclient.so.16
321+
322-
	sleep 1
322+
323-
	wget -O /usr/lib/libmysqlclient.so.16.0.0 http://www.joemg.host56.com/lib/64bits/libmysqlclient.so.16.0.0
323+
324-
	sleep 1
324+
325-
	wget http://www.raptorcache.com/install/64/raptor64.tar.gz
325+
326-
	sleep 1
326+
327-
	wget http://www.raptorcache.com/install/clean/64/clean.zip
327+
328-
	sleep 1
328+
## Raptor
329-
	wget http://www.raptorcache.com/install/64/plugins/plugins.tar.gz
329+
# min(0-59)  hour(0-23)  days(1-31)  month(1-12)  weekly(0-7)   user   command
330-
	sleep 1
330+
331-
	cp raptor64.tar.gz /tmp
331+
332-
	tar -xzvf /tmp/raptor64.tar.gz -C /
332+
333-
	rm -rf raptor64.tar.gz
333+
334-
	chmod a+x /usr/sbin/raptor
334+
335-
	
335+
336-
elif [ $P = i386 ] ; then
336+
337
sleep 6
338-
	wget -O /usr/lib/libmysqlclient.so.16 http://www.joemg.host56.com/lib/32bits/libmysqlclient.so.16
338+
339-
	sleep 1
339+
apt-get update
340-
	wget -O /usr/lib/libmysqlclient.so.16.0.0 http://www.joemg.host56.com/lib/32bits/libmysqlclient.so.16.0.0
340+
341-
	sleep 1
341+
342-
	wget http://www.raptorcache.com/install/32/raptor32.tar.gz
342+
343-
	sleep 1
343+
344-
	wget http://www.raptorcache.com/install/clean/32/clean.zip
344+
345-
	sleep 1
345+
346-
	wget http://www.raptorcache.com/install/32/plugins/plugins.tar.gz
346+
347-
	sleep 1
347+
348-
	tar -xzvf /tmp/raptor32.tar.gz -C /
348+
349-
	rm -rf raptor32.tar.gz
349+
350-
	chmod a+x /usr/sbin/raptor
350+
echo Y | apt-get install mysql-server mysql-client php5-mysql &&
351
echo Y | aptitude install php5-cgi &&
352
echo Y | apt-get -f upgrade &&
353
354
wget http://www.raptorcache.com/install/var/raptor.sql
355
cp raptor.sql /var/tmp/
356
rm -rf raptor.sql
357
echo
358
359
mysql -u root -praptor << eof
360
CREATE DATABASE raptor;
361
eof
362
mysql -u root -praptor raptor < /var/tmp/raptor.sql
363
364
sleep 6
365
366
IPSERV=$(ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')				 
367
HOST_NAME="local.war.net"	
368
369
sleep 3
370
371
mv /etc/hosts /etc/hosts_
372
touch /etc/hosts
373
374
echo "127.0.0.1	localhost.localdomain	localhost
375
$IPSERV	proxy.$HOST_NAME	proxy
376
#
377
::1	localhost	ip6-localhost	ip6-loopback
378
fe00::0 ip6-localnet
379
fe00::0 ip6-mcastprefix
380
ff02:1 ip6-allnodes
381
ff02::2 ip6-allrouters
382
ff02::3 ip6-allhosts" >> /etc/hosts
383
384
sleep 3
385
386
mv /etc/hostname /etc/hostname_
387
touch /etc/hostname
388
389
echo "proxy.$HOST_NAME" >> /etc/hostname
390
391
mv /etc/resolv.conf /etc/resolv.conf_
392
touch /etc/resolv.conf
393
394
echo "search proxy.$HOST_NAME
395
nameserver 127.0.0.1
396
nameserver 8.8.8.8
397
nameserver 8.8.4.4" >> /etc/resolv.conf
398-
echo "PIDFILE /var/run/raptor.pid" >> /etc/raptor/raptor.conf
398+
399
sleep 3
400
401
echo Y | apt-get install bind9 dnsutils bind9-doc 
402
403
sleep 3
404
405
mv /etc/bind/named.conf.options /etc/bind/named.conf.options_old
406-
echo "## Raptor
406+
407-
# min(0-59)  hora(0-23)  diames(1-31)  mes(1-12)  diasem(0-7)  user   comando
407+
408
echo "options {
409
        directory "/var/cache/bind";
410
        forward only;
411
        forwarders { 8.8.8.8; 8.8.4.4; };
412
	auth-nxdomain no; # conform to RFC1035
413
        listen-on-v6 { none; };
414
        listen-on { 127.0.0.1; };
415
        version none;
416-
#-------------------------------------------------------------------------------------------
416+
417
418
echo "include "/etc/bind/zones.rfc1918";
419
logging {
420
category lame-servers {null; }; 
421
category edns-disabled { null; }; 
422
};" >> /etc/bind/named.conf.local
423
424
echo "ServerName proxy.$HOST_NAME" >> /etc/apache2/apache2.conf
425
426-
echo Y | apt-get install mysql-server mysql-client php5-mysql 
426+
427-
echo Y | aptitude install php5-cgi 
427+
428
touch /etc/cacti/httpd.conf
429
echo "Listen 82
430
<VirtualHost *:82>
431
 DocumentRoot /var/raptor
432
 ServerName www.raptorcache.com
433
 ErrorLog /var/log/virtual82-error_log
434
 CustomLog /var/log/virtual82-access_log common
435
 </VirtualHost>
436
 Listen 84
437
<VirtualHost *:84>
438
 DocumentRoot /var/www/sarg
439
 ServerName www.raptorcache.com
440-
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ BATAS
440+
441
442
sleep 6
443-
HOST_NAME=$(hostname -a) 
443+
444-
DOMAIN_NAME=$(hostname -d)	 
444+
445
446-
echo "ServerName www.$DOMAIN_NAME" >> /etc/apache2/apache2.conf
446+
447
echo "
448
# Repository Sarg for debian
449
# deb http://backports.debian.org/debian-backports squeeze-backports main" >> /etc/apt/sources.list
450-
# touch /etc/cacti/httpd.conf
450+
apt-get update
451
echo Y | aptitude install sarg
452
mv /etc/sarg/sarg.conf  /etc/sarg/sarg.conf_old
453
wget http://www.raptorcache.com/install/var/sarg.conf
454
mv sarg.conf /etc/sarg/sarg.conf
455-
 ServerName www.$DOMAIN_NAME
455+
456
# Schedulle of Sarg
457
59              21               *       *               *       root    sarg" >> /etc/crontab
458
mkdir /var/www/sarg/
459
sarg -x
460
461
sleep 1
462-
 ServerName www.$DOMAIN_NAME
462+
463
tar -xzvf raptor.tar.gz
464
mv raptor /var/
465
rm -rf raptor.tar.gz
466
clear
467
chmod 777 /var/raptor/*
468
chmod 777 /var/raptor/mail/*
469
chmod 777 /etc/raptor/raptor.lst
470
chmod 777 /etc/squid3/squid.conf
471
chmod 777 /etc/raptor/raptor.conf
472
chmod 777 /etc/squid3/denegados.lst
473
chmod 777 /etc/network/interfaces
474
chmod 777 /etc/resolv.conf
475
clear
476
477-
sarg
477+
478
echo Y | apt-get install snmpd
479
mv /etc/snmp/snmpd.conf  /etc/snmp/snmpd.conf.old
480
touch /etc/snmp/snmpd.conf
481
echo 'rocommunity  public
482
syslocation  "PDC, Proxy DataCenter"
483
syscontact  [email protected]' >  /etc/snmp/snmpd.conf
484
rm -rf /etc/default/snmpd
485
wget http://www.raptorcache.com/install/var/snmpd 
486
mv snmpd /etc/default/
487
/etc/init.d/snmpd restart
488
sleep 3
489
clear
490
echo ""
491
echo ""
492
echo "+--------------------------------------------------------------------------------------+"
493
echo "|                                    Installing Cacti                                  |"
494
echo "|         Choose Apache2 as web server and then enter the password Mysql(raptor)       |"
495
echo "+--------------------------------------------------------------------------------------+"
496
echo Press enter to continue...
497-
mv /etc/snmp/snmpd.conf  /etc/snmp/snmpd.conf_
497+
498
echo Y | apt-get install cacti
499-
echo "rocommunity  public
499+
500
mv raptor-cacti.sql /var/tmp/
501-
syscontact  admin@$DOMAIN_NAME" >>  /etc/snmp/snmpd.conf
501+
502
sleep 1
503-
wget http://www.raptorcache.com/install/var/snmpd
503+
mv /etc/cacti/apache.conf /etc/cacti/apache.conf_
504
touch /etc/cacti/apache.conf
505
echo "Alias /graphcacti /usr/share/cacti/site
506
507
<Directory /usr/share/cacti/site>
508
	Options +FollowSymLinks
509
	AllowOverride None
510
	order allow,deny
511
	allow from all
512
513
	AddType application/x-httpd-php .php
514
515
	<IfModule mod_php5.c>
516
		php_flag magic_quotes_gpc Off
517
		php_flag short_open_tag On
518
		php_flag register_globals Off
519
		php_flag register_argc_argv On
520
		php_flag track_vars On
521
		# this setting is necessary for some locales
522-
rm /etc/cacti/apache.conf 
522+
		php_value mbstring.func_overload 0
523
		php_value include_path .
524
	</IfModule>
525
526
	DirectoryIndex index.php
527-
        Options +FollowSymLinks
527+
528-
        AllowOverride None
528+
/etc/init.d/apache2 restart
529-
        order allow,deny
529+
530-
        allow from all
530+
531
vnstat -u -i eth0
532-
        AddType application/x-httpd-php .php
532+
533
echo Y | apt-get install smartmontools lvm2 hdparm
534-
        <IfModule mod_php5.c>
534+
535-
                php_flag magic_quotes_gpc Off
535+
536-
                php_flag short_open_tag On
536+
537-
                php_flag register_globals Off
537+
538-
                php_flag register_argc_argv On
538+
539-
                php_flag track_vars On
539+
540-
                # this setting is necessary for some locales
540+
541-
                php_value mbstring.func_overload 0
541+
542-
                php_value include_path .
542+
543-
        </IfModule>
543+
544
read -n 0 -ers
545-
        DirectoryIndex index.php
545+
546-
</Directory>
546+
547
/etc/init.d/module-init-tools restart
548-
Alias /cacti /usr/share/cacti/site
548+
549
# DNS Cache
550
*/2               *               *       *               *       root    rndc dumpdb" >> /etc/crontab
551-
        Options +FollowSymLinks
551+
552-
        AllowOverride None
552+
553-
        order allow,deny
553+
554-
        allow from all
554+
555
chmod 777 /usr/lib/cgi-bin/upload.cgi
556-
        AddType application/x-httpd-php .php
556+
557
echo Y | apt-get install sudo
558-
        <IfModule mod_php5.c>
558+
559-
                php_flag magic_quotes_gpc Off
559+
chmod 777/etc/sudoers
560-
                php_flag short_open_tag On
560+
561-
                php_flag register_globals Off
561+
562-
                php_flag register_argc_argv On
562+
563-
                php_flag track_vars On
563+
564-
                # this setting is necessary for some locales
564+
565-
                php_value mbstring.func_overload 0
565+
566-
                php_value include_path .
566+
	Options +FollowSymLinks
567-
        </IfModule>
567+
	AllowOverride None
568
	order allow,deny
569-
        DirectoryIndex index.php
569+
	allow from all
570
571
	AddType application/x-httpd-php .php
572
573
	<IfModule mod_php5.c>
574
		php_flag magic_quotes_gpc Off
575
		php_flag short_open_tag On
576
		php_flag register_globals Off
577
		php_flag register_argc_argv On
578
		php_flag track_vars On
579
		# this setting is necessary for some locales
580
		php_value mbstring.func_overload 0
581
		php_value include_path .
582
	</IfModule>
583
584
	DirectoryIndex index.php
585
</Directory>" >> /etc/apache2/conf.d/apc.conf
586
echo "extension=apc.so" >> /etc/php5/conf.d/apc.ini
587
echo "; APC Configuration
588
apc.enabled = 1
589
; Memory allocated to APC. Use Munin or APC Info to see if more is needed.
590
apc.shm_size=32M
591
; rfc1867 allow file upload progression display.
592
apc.rfc1867 = on" >> /etc/php5/conf.d/apc-config.ini
593
clear
594
rm -rf /var/tmp/*
595
rm -rf web.zip
596
597
echo ""
598
echo ""
599
echo ""
600-
chmod 777 /etc/sudoers
600+
601-
# If this script can't execute chmod 777 /etc/sudoers, you can use winscp 
601+
602-
# since everyone in the "www-data" group will thereafter be able to completely hose this machine.
602+
echo "|                                                                          |"
603-
# so please be carefull with your webadmin and goodluck.
603+
604
echo "|                                                                          |"
605
echo "|            Reboot your system to complete the installation               |"
606
echo "|                                                                          |"
607
echo "+==========================================================================+"
608
echo ""
609
echo ""