-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall.sh
executable file
·263 lines (238 loc) · 8.08 KB
/
install.sh
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
OS=$(lsb_release -si)
ARCH=$(uname -m | sed 's/x86_//;s/i[3-6]86/32/')
VER=$(lsb_release -sr)
if [ $OS == CentOS ]; then
centos=1
fi
SERVICEMIX_VERSION=5.0.1
echo =============================================
echo this is a demo installatin script
echo "don't run this script on a production system!"
echo "this script is tested on Ubuntu 14.04 LTS / CentOS 6.5 (install iRODS manually)"
echo press ENTER to continue, type irods to install irods only, type indexing to install indexing only
echo =============================================
read enter
echo "zone name:"
read zoneName
echo "iRODS user:"
read user
echo "iRODS password:"
read password
if [ "$enter" == irods ]; then
install_irods=yes
install_indexing=no
echo "AMQP host:"
read hostname
else
hostname=`hostname`
if [ "$enter" == indexing ]; then
install_irods=no
install_indexing=yes
echo "iRODS host:"
read irodshost
else
install_irods=yes
install_indexing=yes
hostname=localhost
irodshost=localhost
fi
fi
sudo service irods stop
sudo service postgresql stop
echo kill all processes
sudo killall java postgres irodsServer irodsReServer
echo make new directory
mkdir indexing
cd indexing
if [ "$centos" ]; then
if [ -e epel-release-6-8.noarch.rpm ]; then
echo epel-release-6-8.noarch.rpm already exists, skip downloading
else
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
fi
sudo rpm -Uvh epel-release-6-8.noarch.rpm
sudo yum install curl java-1.7.0-openjdk java-1.7.0-openjdk-devel byacc git xmlstarlet gcc gcc-c++ cmake libuuid-devel swig python-devel
else
echo installing required packages
sudo apt-get install maven curl openjdk-7-jdk git xmlstarlet gcc cmake uuid-dev swig python-dev
sudo apt-get install postgresql g++
fi
echo installing irods
if [[ $install_irods != yes || -e /var/lib/irods ]]; then
echo irods already installed
else
wget ftp://ftp.renci.org/pub/irods/releases/4.0.2/irods-icat-4.0.2-64bit.deb
wget ftp://ftp.renci.org/pub/irods/releases/4.0.2/irods-database-plugin-postgres-1.2.deb
sudo dpkg -i irods-icat-4.0.2-64bit.deb irods-database-plugin-postgres-1.2.deb
sudo apt-get -f install
sudo service postgresql start
echo enter database username:
read testUsername
echo enter database password:
read testPassword
sudo su - postgres -c "psql -c \"CREATE USER $testUsername WITH PASSWORD '$testPassword';\"; psql -c 'CREATE DATABASE \"ICAT\"'; psql -c 'GRANT ALL PRIVILEGES ON DATABASE \"ICAT\" TO $testUsername'"
echo =======================================
echo make sure you set zone name to $zoneName
echo =======================================
sudo su - irods -c "packaging/setup_database.sh"
fi
IRODS_HOME=/var/lib/irods
IRODS_CONFIG=/etc/irods
IRODS_RULES=$IRODS_CONFIG
IRODS_CMD=$IRODS_HOME/iRODS/server/bin/cmd
ICOMMANDS=/usr/bin
if [ $install_irods == yes ]; then
echo installing qpid messenger
if [ -d qpid-proton-0.7 ]; then
echo qpid messenger already installed
else
if [ -e qpid-proton-0.7.tar.gz ]; then
echo file qpid-proton-0.7.tar.gz already exists, skip downloading
else
wget http://mirror.symnds.com/software/Apache/qpid/proton/0.7/qpid-proton-0.7.tar.gz
fi
tar zxvf qpid-proton-0.7.tar.gz
cd qpid-proton-0.7
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DSYSINSTALL_BINDINGS=ON
make all
sudo make install
cd ../..
fi
fi
if [ $install_indexing == yes ]; then
echo installing servicemix
if [ -d apache-servicemix-$SERVICEMIX_VERSION ]; then
echo service mix already installed
else
if [ -e apache-servicemix-$SERVICEMIX_VERSION.zip ]; then
echo file apache-servicemix-$SERVICEMIX_VERSION.zip already exists, skip downloading
else
wget http://archive.apache.org/dist/servicemix/servicemix-5/$SERVICEMIX_VERSION/apache-servicemix-$SERVICEMIX_VERSION.zip
fi
unzip apache-servicemix-$SERVICEMIX_VERSION.zip
cd apache-servicemix-$SERVICEMIX_VERSION
bin/start
echo "waiting for servicemix"
sleep 10
bin/client -p 8101 -h localhost -u karaf -u karaf features:install camel-jms
bin/stop
xmlstarlet ed -N ns="http://activemq.apache.org/schema/core" \
--append "//ns:transportConnector[@name='openwire']" \
--type elem \
-n transportConnector \
--value "" \
--subnode "//transportConnector[not(@name)]" \
--type attr \
-n name \
--value "amqp" \
--subnode "//transportConnector[@name='amqp']" \
--type attr \
-n uri \
--value "amqp://0.0.0.0:5672" \
--append "//transportConnector[@name='amqp']" \
--type elem \
-n transportConnector \
--value "" \
--subnode "//transportConnector[not(@name)]" \
--type attr \
-n name \
--value "websocket" \
--subnode "//transportConnector[@name='websocket']" \
--type attr \
-n uri \
--value "ws://0.0.0.0:61614" \
--delete "//ns:jaasAuthenticationPlugin" \
etc/activemq.xml > etc/activemq.xml.new
mv etc/activemq.xml etc/activemq.xml.bak
mv etc/activemq.xml.new etc/activemq.xml
cd ..
fi
APACHE_SERVICEMIX=`pwd`/apache-servicemix-$SERVICEMIX_VERSION
echo installing elasticsearch
if [ -e elasticsearch-1.1.1.tar.gz ]; then
echo file elasticsearch-1.1.1.tar.gz already exists, skip downloading
else
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.1.1.tar.gz
fi
tar zxvf elasticsearch-1.1.1.tar.gz
if [ "$centos" ]; then
echo disable multicast on CentOS
sed -i 's/^[# ]*discovery.zen.ping.multicast.enabled:.*/discovery.zen.ping.multicast.enabled: false/' elasticsearch-1.1.1/config/elasticsearch.yml
fi
sed -i 's/^[# ]*cluster.name:.*/cluster.name: databookIndexer/' elasticsearch-1.1.1/config/elasticsearch.yml
nohup elasticsearch-1.1.1/bin/elasticsearch &
echo "waiting for elasticsearch"
sleep 10
curl -XPUT 'http://localhost:9200/databook'
curl -XPUT 'http://localhost:9200/databook/entity/_mapping' -d '{"properties":{"uri":{"type":"string", "index":"not_analyzed"}, "type":{"type":"string", "index":"not_analyzed"}}}'
echo installing bundles
echo erilex
git clone https://github.com/xu-hao/erilex
cd erilex
mvn install
cd ..
echo indexing
git clone https://github.com/DICE-UNC/indexing
cd indexing
sed -i -e "s/^\(irods[.]host=\).*/\1$irodshost/" \
-e "s/^\(irods[.]home=\/\)[^/]*\(\/.*.\)/\1$zoneName\2/" \
-e "s/^\(irods[.]zone=\).*/\1$zoneName/" \
-e "s/^\(irods[.]user=\).*/\1$user/" \
-e "s/^\(irods[.]password=\).*/\1$password/" \
src/databook/config/irods.properties
mvn install -DskipTests=true
cp target/*.jar $APACHE_SERVICEMIX/deploy/
cd ..
echo camel-router
git clone https://github.com/DICE-UNC/indexing-camel-router
cd indexing-camel-router
mvn install
cp target/*.jar $APACHE_SERVICEMIX/deploy/
cd ..
echo elasticsearch-indexer
git clone https://github.com/DICE-UNC/elasticsearch
cd elasticsearch
mvn install
cp target/*.jar $APACHE_SERVICEMIX/deploy/
cd ..
fi
if [ $install_irods == yes ]; then
echo installing config files
git clone https://github.com/DICE-UNC/indexing-irods
cd indexing-irods
sudo ln -s `which file` $IRODS_CMD/file
sudo cp amqpsend.py $IRODS_CMD
sudo chmod +x $IRODS_CMD/amqpsend.py
sudo cp *.re $IRODS_RULES
sudo chown irods:irods $IRODS_RULES/*.re
sudo sed -i 's/^\([^\"]*\"\)localhost\(.*\)/\1'$hostname'\2/' $IRODS_RULES/databook.re
a=`sudo grep amqp $IRODS_CONFIG/server.config`
if [ "$a" != "" ]; then
echo server.config is already edited
else
sudo sed -i 's/^\(reRuleSet *\)\([^ ]*\)/\1amqp,databook_pep,databook,\2/' $IRODS_CONFIG/server.config
fi
cd ..
fi
echo ==========================================
echo done
echo start the services in the following order:
echo "irods | elasticsearch servicemix"
echo ==========================================
echo to start elasticsearch run:
echo indexing/elasticsearch-1.1.1/bin/elasticsearch
echo to start irods run:
echo sudo service postgresql start
echo sudo service irods start
echo to start servicemix run:
echo $APACHE_SERVICEMIX/bin/servicemix server
echo to start search gui run:
echo firefox indexing/elasticsearch/src/index.html
echo to test run the follow commands:
echo wget http://www.gutenberg.org/cache/epub/19033/pg19033.txt
echo wget http://www.gutenberg.org/cache/epub/1661/pg1661.txt
echo iput pg19033.txt
echo iput pg1661.txt
cd ..