Skip to content

Instantly share code, notes, and snippets.

@leon
Created November 30, 2011 14:36
Show Gist options
  • Save leon/1409273 to your computer and use it in GitHub Desktop.
Save leon/1409273 to your computer and use it in GitHub Desktop.
Tomcat 7

Update

apt-get update

Install java

apt-get install sun-java6-jdk

Make sure java is available to ./configure otherwise it wont build

echo JAVA_HOME="/usr/lib/jvm/java-6-sun" >> /etc/environment
echo JRE_HOME="/usr/lib/jvm/java-6-sun/jre" >> /etc/environment
wget http://apache.mirrors.spacedump.net/tomcat/tomcat-7/v7.0.23/bin/apache-tomcat-7.0.23.tar.gz
tar -xvf apache-tomcat-7.0.23.tar.gz

move into place

mv apache-tomcat-7.0.23 /etc/tomcat7

install APR

apt-get install libaprutil1-dev libssl-dev

build apache APR

tar -xvf /etc/tomcat7/bin/tomcat-native.tar.gz
cd /etc/tomcat7/bin/tomcat-native-1.1.22-src/jni/native
./configure --with-apr="/usr/bin/apr-1-config" && make && make install

Link into tomcat library path

cd /etc/lib
ln -s /usr/local/apr/lib/libtcnative-1.so libtcnative-1.so

setup autostart, add /etc/init.d/tomcat7

# Tomcat auto-start
#
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid

case $1 in
start)
sh /etc/tomcat7/bin/startup.sh
;;
stop)
sh /etc/tomcat7/bin/shutdown.sh
;;
restart)
sh /etc/tomcat7/bin/shutdown.sh
sh /etc/tomcat7/bin/startup.sh
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment