インストーラー
wget ftp:\\yourdeployment.server.local/tomcat7.tar.gz
tar xvzf tomcat7.tar.gz
cp -f tomcat /usr/share/tomcat7
rm -f /usr/share/tomcat
ln -s /usr/share/tomcat7 /usr/share/tomcat
chmod 777 /usr/share/tomcat7/bin/ *.sh
useradd -d /usr/share/tomcat -s /sbin/nologin tomcat
chown -R tomcat /usr/share/tomcat7
rm -f /etc/init.d/tomcat
cp -f /usr/share/tomcat7/tomcat /etc/init.d/
chmod +x /etc/init.d/tomcat
rm -f /etc/profile.d/env.sh
cp -f /usr/share/tomcat7/env.sh /etc/profile.d/
chmod +x /etc/profile.d/env.sh
chmod 755 /etc/init.d/tomcat
ネイティブ パッケージのインストール
cd /usr/share/tomcat7/bin
tar -xvzf tomcat-native.tar.gz
cd tomcat-native-<replace with current version>-src/jni/native
./configure --with-apr=/usr && make && sudo make install
cd /usr/lib
rm -f libtcnative-1.so
ln -s /usr/local/apr/lib/libtcnative-1.so libtcnative-1.so
init 6
Tomcat ファイル:
#!/bin/bash
chkconfig: 234 20 80
description: Tomcat Server basic start/shutdown script
processname: tomcat
export JAVA_HOME=/jdk7
export TOMCAT_HOME=/usr/share/tomcat7
export JEE_JAR=/jdk7
export JRE_HOME=/jdk7/jre
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
case $1 in
start)
sh /usr/share/tomcat7/bin/startup.sh
;;
stop)
sh /usr/share/tomcat7/bin/shutdown.sh
;;
restart)
sh /usr/share/tomcat7/bin/shutdown.sh
sh /usr/share/tomcat7/bin/startup.sh
;;
esac
exit 0
env.sh
export JAVA_HOME=/jdk7
export JRE_HOME=$JAVA_HOME
export TOMCAT_HOME=/usr/share/tomcat7
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JRE_HOME/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar