Revision 8916
Added by Jing Tao about 10 years ago
src/scripts/bash/install-java7-tomcat7.sh | ||
---|---|---|
1 | 1 |
#!/bin/bash |
2 | 2 |
#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 |
#It modifies the workers.properties file for apache-tomcat connector.
|
|
3 |
#It will update the alternatives for java, javac, keytool and javaws to openjdk-7.
|
|
4 |
#It will modify the /etc/tomcat7/catalina.properties to allow DataONE idenifiers.
|
|
5 |
#It will modify the workers.properties file for apache-tomcat connector.
|
|
6 | 6 |
#The user running the script should have the sudo permission. |
7 | 7 |
|
8 |
NEW_JDK_PACKAGE=openjdk-7-jdk |
|
8 | 9 |
NEW_JDK_HOME=/usr/lib/jvm/java-7-openjdk-amd64 |
10 |
|
|
11 |
JK_CONF=/etc/apache2/mods-enabled/jk.conf |
|
12 |
|
|
13 |
NEW_TOMCAT=tomcat7 |
|
9 | 14 |
NEW_CATALINA_PROPERTIES=/etc/tomcat7/catalina.properties |
10 |
JK_CONF=/etc/apache2/mods-enabled/jk.conf |
|
11 | 15 |
NEW_TOMCAT_HOME=/usr/share/tomcat7 |
12 | 16 |
NEW_TOMCAT_BASE=/var/lib/tomcat7 |
17 |
TOMCAT_CONFIG_SLASH='org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true' |
|
18 |
TOMCAT_CONFIG_BACKSLASH='org.apache.catalina.connector.CoyoteAdapter.ALLOW_BACKSLASH=true' |
|
13 | 19 |
|
14 |
echo "install openjdk-7-jdk"
|
|
15 |
sudo apt-get install openjdk-7-jdk
|
|
20 |
echo "install ${NEW_JDK_PACKAGE}"
|
|
21 |
sudo apt-get install ${NEW_JDK_PACKAGE}
|
|
16 | 22 |
sleep 3 |
17 | 23 |
echo "configure java, java, keytool and javaws" |
18 | 24 |
sudo update-alternatives --set java ${NEW_JDK_HOME}/jre/bin/java |
... | ... | |
20 | 26 |
sudo update-alternatives --set keytool ${NEW_JDK_HOME}/jre/bin/keytool |
21 | 27 |
sudo update-alternatives --set javaws ${NEW_JDK_HOME}/jre/bin/javaws |
22 | 28 |
|
23 |
echo "install tomcat7" |
|
24 |
sudo apt-get install tomcat7 |
|
25 |
sudo sed -i.bak '$ a\org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true' ${NEW_CATALINA_PROPERTIES} |
|
26 |
sudo sed -i '$ a\org.apache.catalina.connector.CoyoteAdapter.ALLOW_BACKSLASH=true' ${NEW_CATALINA_PROPERTIES} |
|
29 |
echo "install ${NEW_TOMCAT}" |
|
30 |
sudo apt-get install ${NEW_TOMCAT} |
|
31 |
if grep -q "${TOMCAT_CONFIG_SLASH}" ${NEW_CATALINA_PROPERTIES}; then |
|
32 |
echo "${TOMCAT_CONFIG_SLASH} exists and don't need to do anything." |
|
33 |
else |
|
34 |
echo "${TOMCAT_CONFIG_SLASH} don't exist and add it." |
|
35 |
sudo sed -i.bak "$ a\\${TOMCAT_CONFIG_SLASH}" ${NEW_CATALINA_PROPERTIES} |
|
36 |
fi |
|
37 |
if grep -q "${TOMCAT_CONFIG_BACKSLASH}" ${NEW_CATALINA_PROPERTIES}; then |
|
38 |
echo "${TOMCAT_CONFIG_BACKSLASH} exists and don't need to do anything." |
|
39 |
else |
|
40 |
echo "${TOMCAT_CONFIG_BACKSLASH} don't exist and add it." |
|
41 |
sudo sed -i "$ a\\${TOMCAT_CONFIG_BACKSLASH}" ${NEW_CATALINA_PROPERTIES} |
|
42 |
fi |
|
27 | 43 |
|
44 |
|
|
45 |
|
|
46 |
|
|
28 | 47 |
echo "read the location of the workers.properties file from the jk_conf" |
29 | 48 |
while read f1 f2 |
30 | 49 |
do |
Also available in: Unified diff
Only insert new configuration lines once to the /etc/tomcat7/catalina.properties.