/
INSTALLATION
357 lines (255 loc) · 10.9 KB
/
INSTALLATION
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
INTRODUCTION
This document describes how to install KRE.
* KRE runs as an Apache module. Thus, installing Apache is a key to making it work.
* KRE is a mod_perl Apache module. Thus, there are a lot of Perl pre-requisites.
TODO
* The installation is too complex. This ought to be easier.
* We assume Centos, Fedora, or Redat. We should test and expand instructions to include other Linux distros.
* The installation *has* to be done in the /web/lib/perl directory. This restriction should be removed
* The installation depends on a custom build of Apache. Can we use the stock distribution?
GETTING YOUR MACHINE READY
The following steps install libraries and systems necessary to make KRE work. The good news is that even those these are fairly lengthy, they are pretty straightforward for Centos/Redhat installs.
1. Ensure that the following packages are installed and current
autoconf
bzip2
curl-devel
expat-devel
gcc
java-1.6.0-openjdk
java-1.6.0-openjdk-devel
libevent-devel
libxml2-devel
make
memcached
neon-devel
openssl-devel
perl
subversion
subversion-devel
subversion-perl
sudo
wget
zlib-devel
In Redhat Linux and it's siblings:
sudo yum -y --enablerepo=rpmforge,rpmforge-extras install autoconf bzip2 curl-devel expat-devel gcc java-1.6.0-openjdk java-1.6.0-openjdk-devel libevent-devel libxml2-devel make memcached neon-devel openssl-devel perl subversion subversion-devel subversion-perl sudo wget zlib-devel
Note: some of these packages are NOT included in the default package manager for Centos, so you need to add an additional package manager as per these instructions: http://www.lullabot.com/articles/installing-memcached-redhat-or-centos (you can skip the PHP part at the end).
2. Make install directory (as root)
useradd web -d /web -m
cd /web
mkdir {logs,src}
chown -R web:web /web
passwd web
3. Log in as web.
4. Add KOBJ_ROOT and WEB_ROOT to /web/.bashrc file
export KOBJ_ROOT=/web/lib/perl
export WEB_ROOT=/web
# the following aliases can also be useful
alias err="tail -f ~/logs/error_log"
alias acc="tail -f ~/logs/access_log"
alias log="tail -f /web/logs/detail_log"
alias start="sudo /etc/init.d/httpd start"
alias restart="sudo /etc/init.d/httpd restart"
alias stop="sudo /etc/init.d/httpd stop"
Execute the following to make them active
. ~/.bashrc
5. Install Apache (http://archive.apache.org/dist/httpd/httpd-2.2.15.tar.gz)
cd /web/src
wget http://archive.apache.org/dist/httpd/httpd-2.2.15.tar.gz
tar -zxvf httpd-2.2.15.tar.gz
cd httpd-2.2.15
./configure --with-mpm=prefork --prefix=/web --with-included-apr --enable-deflate=shared --enable-expires=shared --enable-headers=shared --enable-dav=shared
make
make install
6. Install Mod Perl (http://perl.apache.org/dist/mod_perl-2.0-current.tar.gz)
# note: for Fedora 14 installs run "yum install perl-ExtUtils-Embed" first.
cd /web/src
wget http://perl.apache.org/dist/mod_perl-2.0-current.tar.gz
tar -zxvf mod_perl-2.0-current.tar.gz
cd mod_perl-2.0.5
a. for 64 bit CentOS machines:
sudo ln -s /usr/lib64/libgdbm.so.2.0.0 /usr/lib64/libgdbm.so; perl Makefile.PL MP_APXS=/web/bin/apxs
b. for 32 bit CentOS machines:
sudo ln -s /usr/lib/libgdbm.so.2.0.0 /usr/lib/libgdbm.so; perl Makefile.PL MP_APXS=/web/bin/apxs
c. for 64 bit Fedora 14 machines
sudo ln -s /usr/lib64/libgdbm.so.3.0.0 /usr/lib64/libgdbm.so; perl Makefile.PL MP_APXS=/web/bin/apxs
d. for 32 bit Fedora 14 machines
sudo ln -s /usr/lib/libgdbm.so.3.0.0 /usr/lib/libgdbm.so; perl Makefile.PL MP_APXS=/web/bin/apxs
make
sudo make install
7. Install Geo-IP (http://geolite.maxmind.com/download/geoip/api/c/GeoIP-1.4.3.tar.gz)
cd /web/src
wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP-1.4.3.tar.gz
tar -zxvf GeoIP-1.4.3.tar.gz
cd GeoIP-1.4.3
./configure --prefix=/web
make
sudo make install
Download the GeoLite Country and City files from the Maxmind site:
http://www.maxmind.com/app/ip-location
Place the unzipped data files in /use/local/share where GeoIP expects to find them.
8. Install Cronolog (http://cronolog.org/download/cronolog-1.6.2.tar.gz)
cd /web/src
wget http://cronolog.org/download/cronolog-1.6.2.tar.gz
tar -zxvf cronolog-1.6.2.tar.gz
cd cronolog-1.6.2
./configure --prefix=/web
make
sudo make install
9. Install Git (http://kernel.org/pub/software/scm/git/git-1.7.3.5.tar.bz2)
cd /web/src
wget http://git-core.googlecode.com/files/git-1.7.7.tar.gz
tar -zxvf git-1.7.7.tar.gz
cd git-1.7.7
./configure
make
sudo make install
10. Start memcache (init script)
sudo /sbin/chkconfig --add memcached
sudo /sbin/service memcached start
11. Install MyConfig.pm #didn't do.....
sudo mkdir -p /root/.cpan/CPAN
cd /web/src
wget http://kinetic-resources.s3.amazonaws.com/MyConfig.pm
sudo cp MyConfig.pm /root/.cpan/CPAN
Note: you may want to update the CPAN mirrors in this list.
12. Install newest version of CPAN (Optional - as of the writing of these instructions, the version was v1.9402)
perl -MCPAN -e 'install Bundle::CPAN'
Answer "n" to "Do you want to modify/update your configuration (y|n)" question
Hit return on "Enter arithmetic or Perl expression: exit" question
13. Install Kinetic.pm Bundle (http://kinetic-resources.s3.amazonaws.com/Kinetic.pm)
sudo mkdir -p /root/.cpan/Bundle
cd /web/src
sudo wget http://kinetic-resources.s3.amazonaws.com/Kinetic.pm
sudo cp Kinetic.pm /root/.cpan/Bundle
sudo -s # now you are root
cd /root/.cpan/Bundle
perl -MCPAN -e 'install Bundle::Kinetic')"
exit
Hit return on "Which SSL install path do you want to use? [/usr]" question
Hit return on "Do you want to run the live tests (y/N)? [N] " question
Answer "y" to "Do you want to install Module::Build? [y]" question
Answer "n" to "Do you want to install Inline::C? [y]" question
Hit return on "Do you want to install JSON::XS?(Y/n) [Y]" question
Hit return on "Auto-install the 1 optional module(s) from CPAN? [y]" question during the Net-Twttier-Lite module install
Hit return on "Auto-install the 1 mandatory module(s) from CPAN? [y]" question during the XML-LibXML module install
Hit return on "Auto-install the 1 optional module(s) from CPAN? [y]" question during the JSON-Syck module install
Answer "y" to the "Auto-install the 1 optional module(s) from CPAN? [n]" question during the JSON-XS module install
Answer "y" to the "Auto-install the 1 optional module(s) from CPAN? [n]" question during the JSON module install
Hit return on the "Auto-install the 1 optional module(s) from CPAN? [n]" question during the JSON-DWIW module install
Hit return on the "Do you want to install it permanently? [yes]" question during the IPC-Cmd module install
Hit return on the "Do you want to install it permanently? [yes]" question during the ExtUtils-CBuilder module install
Hit return on the "Do you want to install it permanently? [yes]" question during the Devel-PPPort module install
Note: this is a large bundle and can experience what seem like non-deterministic failures. Since installing the bundle is idempotent, you can run the install over again to ensure it worked.
14. Install other Perl modules you'll need not in the Bundle:
Math::Round
Data::Diver
MongoDB
15. Note: for Fedora Core 14 (and above?) you need to install Crypt::OpenSSL::X509 by itself
cd /web/src
wget http://search.cpan.org/CPAN/authors/id/D/DA/DANIEL/Crypt-OpenSSL-X509-1.6.tar.gz
tar -zxvf Crypt-OpenSSL-X509-1.6.tar.gz
cd Crypt-OpenSSL-X509-1.6
perl ./Makefile.PL
make
make install
16. Install Test-WWW-Mechanize (http://search.cpan.org/CPAN/authors/id/P/PE/PETDANCE/Test-WWW-Mechanize-1.30.tar.gz)
cd /web/src
wget http://search.cpan.org/CPAN/authors/id/P/PE/PETDANCE/Test-WWW-Mechanize-1.30.tar.gz
tar -zxvf Test-WWW-Mechanize-1.30.tar.gz
cd Test-WWW-Mechanize-1.30
perl ./Makefile.PL
make
sudo make install
17. Install Apache2 Request (http://mirrors.axint.net/apache//httpd/libapreq/libapreq2-2.12.tar.gz)
cd /web/src
wget http://mirrors.axint.net/apache//httpd/libapreq/libapreq2-2.13.tar.gz
tar -zxvf libapreq2-2.13.tar.gz
cd libapreq2-2.13
perl Makefile.PL --with-apache2-apxs=/web/bin/apxs
make
sudo make install
18. Install Apache-Session-Memcached (http://search.cpan.org/CPAN/authors/id/E/EN/ENRYS/Apache-Session-Memcached-0.03.tar.gz)
cd /web/src
wget http://search.cpan.org/CPAN/authors/id/E/EN/ENRYS/Apache-Session-Memcached-0.03.tar.gz
tar -zxvf Apache-Session-Memcached-0.03.tar.gz
cd Apache-Session-Memcached-0.03
perl Makefile.PL
make
sudo make install
19. Install Inline Java (http://search.cpan.org/CPAN/authors/id/P/PA/PATL/Inline-Java-0.52.tar.gz)
cd /web/src
wget http://search.cpan.org/CPAN/authors/id/P/PA/PATL/Inline-Java-0.52.tar.gz
tar -zxvf Inline-Java-0.52.tar.gz
cd Inline-Java-0.52
a. for 32-bit:
perl Makefile.PL J2SDK=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0 BUILD_JNI=0
b. for 64-bit:
perl Makefile.PL J2SDK=/usr/lib/jvm/java-1.6.0-openjdk.x86_64 BUILD_JNI=0
make
sudo make install
20. Install and start MongoDB
Create /etc/yum.repos.d/10gen.repo file and populate it with:
a. for 64-bit OS:
[10gen]
name=10gen Repository
baseurl=http://downloads.mongodb.org/distros/centos/5.4/os/x86_64/
gpgcheck=0
b. for 32-bit OS:
[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686
gpgcheck=0
Install the package:
a. for 64-bit OS
sudo yum -y install mongo-stable mongo-stable
b. for 32-bit OS
sudo yum -y install mongo-10gen mongo-10gen-server # 32-bit
Start MongoDB:
sudo /sbin/service mongod start
21. Install GeoIP Perl module
sudo ln -s /web/share/GeoIP /usr/local/share/GeoIP
cd /web/src
wget http://search.cpan.org/CPAN/authors/id/B/BO/BORISZ/Geo-IP-1.38.tar.gz
tar -zxvf Geo-IP-1.38.tar.gz
# export KOBJ_ROOT=/web/lib/perl
# export WEB_ROOT=/web
cd Geo-IP-1.38
perl Makefile.PL LIBS=-L/web/lib INC=-I/web/include PP=1
make
sudo make install
22. Ensure ownership is correct
sudo chown -R web:web /web
INSTALLATION
1. Get the code
cd /web/lib
git clone git://github.com/kre/Kinetic-Rules-Engine.git
ln -s Kinetic-Rules-Engine perl
2. Create the initial file-based ruleset repository
cp -R /web/lib/perl/etc/install/rulesets /web
3. Start JAVA Inline Parser
cd ~/lib/perl/parser
./buildjava.sh
perl -MInline::Java::Server=restart
4. Install and edit the config file
cp /web/lib/perl/etc/install/kns_config.yml /web/etc
The default values in kns_config.yml should be fine for a development box. Edit for production.
5. Generate the config and init file:
cd /web/lib/perl
bin/install-httpd-conf.pl -aljkfs
bin/install-init-files.pl
6. Create the initial Mongo indexes:
**Need index create script from @MEH**
7. Set up the httpd start up file and start Apache
For Redhat, Centos, and Fedora:
sudo mv /etc/init.d/httpd /etc/init.d/httpd.orig
sudo cp /web/lib/perl/etc/install/httpd /etc/init.d
sudo /sbin/chkconfig --add httpd
sudo /sbin/service httpd start
8. Run PERL smoke tests
su web
cd /web/lib/perl/t
./smoke
KNOWN ISSUES
mongodb indexes
?? SNS keys
?? Log Sink config block