-
Notifications
You must be signed in to change notification settings - Fork 9
/
install.sh
executable file
·77 lines (63 loc) · 2.46 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
#!/bin/bash -e
# -e: Exit immediately if a command exits with a non-zero status.
# Install dependencies depending of the distribution family
echo "Download dependencies"
if which yum &> /dev/null; then
echo "You are in the RedHat family"
sudo yum install java-1.6.0-openjdk
else
echo "You are in the Debian family"
sudo apt-get install openjdk-6-jre openjdk-6-jdk
fi
#DIRS
SCRIPT=$(readlink -f $0)
BASEDIR=`dirname $SCRIPT`
TMP=/tmp
HOME_INSTALL=/usr/local
# Create jetty user
USER_EXIST=$(id -u jetty)
if [ $USER_EXIST == 0 ]; then
sudo groupadd -r jetty
sudo useradd -M -r -g jetty jetty
fi
# Download and Install Jetty Server
echo "Download and Install Jetty Server"
cd $HOME_INSTALL
JETTY_VERSION=7.4.2.v20110526
sudo wget http://archive.eclipse.org/jetty/$JETTY_VERSION/dist/jetty-distribution-$JETTY_VERSION.tar.gz
sudo tar xfz jetty-distribution-$JETTY_VERSION.tar.gz
sudo rm jetty-distribution-$JETTY_VERSION.tar.gz
sudo mv jetty-distribution-$JETTY_VERSION jetty
JETTY_HOME=$HOME_INSTALL/jetty
# Put a new jetty.xml file in JETTY_HOME/etc/
# Now Jetty will listen on port 8983
echo "Replaced old jetty.xml by a new one. Jetty will listen on 8983 port"
sudo cp $BASEDIR/conf/jetty.xml $JETTY_HOME/etc/jetty.xml
#Download and Install Apache Solr
echo "Download and Install Apache Solr"
cd $TMP
wget http://archive.apache.org/dist/lucene/solr/3.6.2/apache-solr-3.6.2.tgz
tar -xzf apache-solr-3.6.2.tgz
rm apache-solr-3.6.2.tgz
# Move Apache Solr Configuration File to Jetty directory
echo "Move Apache Solr Configuration File to Jetty directory"
sudo cp -R $TMP/apache-solr-3.6.2/example/solr/ $JETTY_HOME/
# Copy Apache Solr Application (war file) to Jetty webapp directory
echo "Copy Apache Solr Application (war file) to Jetty webapp directory"
sudo cp $TMP/apache-solr-3.6.2/dist/apache-solr-3.6.2.war $JETTY_HOME/webapps/apache-solr-3.6.2.war
# Copy Solr context from git repository
echo "Copy Solr context from git repository"
sudo cp $BASEDIR/conf/solr.xml $JETTY_HOME/contexts/solr.xml
# Copy Solr Schema
echo "Copy Solr Schema"
sudo cp $BASEDIR/conf/schema.xml $JETTY_HOME/solr/conf/schema.xml
# Copy the jetty startup script
echo "Copy the jetty startup script in /etc/init.d/"
sudo cp $BASEDIR/conf/jetty.sh /etc/init.d/jetty
# Permissions assignments
sudo chown -R jetty:jetty $JETTY_HOME
#Clean up
echo "Clean up"
sudo rm -R $TMP/apache-solr-3.6.2/
echo "Finish"
echo "For launch Jetty and Solr, run the command java -jar start.jar in the directory $JETTY_HOME"