Project

General

Profile

1 8911 tao
#!/bin/bash
2 8909 tao
#This script will install openjdk-7 and tomcat7.
3
#It also updates the alternatives for java, javac, keytool and javaws to openjdk-7.
4
#It also modifies the /etc/tomcat7/catalina.properties to allow DataONE idenifiers.
5 8912 tao
#It modifies the workers.properties file for apache-tomcat connector.
6 8909 tao
#The user running the script should have the sudo permission.
7
8
echo "install openjdk-7-jdk"
9
sudo apt-get install openjdk-7-jdk
10
sleep 3
11
echo "configure java, java, keytool and javaws"
12
sudo update-alternatives --set java /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
13
sudo update-alternatives --set javac /usr/lib/jvm/java-7-openjdk-amd64/bin/javac
14
sudo update-alternatives --set keytool /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/keytool
15
sudo update-alternatives --set javaws /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/javaws
16
17
echo "install tomcat7"
18
sudo apt-get install tomcat7
19
sudo sed -i.bak '$ a\org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true' /etc/tomcat7/catalina.properties
20 8912 tao
sudo sed -i '$ a\org.apache.catalina.connector.CoyoteAdapter.ALLOW_BACKSLASH=true' /etc/tomcat7/catalina.properties
21
22
echo "read the location of the workers.properties file from the jk_conf"
23
while read f1 f2
24
do
25
        if [ "$f1" = "JkWorkersFile" ]; then
26
		JKWORKERPATH="$f2"
27
	fi
28
done < /etc/apache2/mods-enabled/jk.conf
29
echo "the jk workers.properties location is $JKWORKERPATH"
30
31
echo "update the tomcat home and java home in workers.properties file"
32
sudo sed -i.bak --regexp-extended "s/(workers\.tomcat_home=).*/\1\/usr\/share\/tomcat7/;
33
                s/(workers\.java_home=).*/\1\/usr\/lib\/jvm\/java-7-openjdk-amd64/;"\
34
                $JKWORKERPATH