Tag Archives: tomcat

Tomcat hint – Debian

Download java: http://www.oracle.com/technetwork/java/javase/downloads/index.html
and save to /opt
cd /opt
wget http://apache.mirror.vu.lt/apache/tomcat/tomcat-8/v8.0.0-RC3/bin/embed/apache-tomcat-8.0.0-RC3-embed.tar.gz
tar -xvf apache-tomcat-8.0.0-RC3-src.tar.gz
ln -s apache-tomcat-8.0.0-RC3-src tomcat
mkdir /opt/tomcat/logs
groupadd tomcat
useradd -g tomcat -d /opt/tomcat tomcat
usermod -G www-data tomcat
chown tomcat:tomcat tomcat/ -R

vi /etc/init.d/tomcat
#!/bin/sh
CATALINA_HOME=/opt/tomcat
export CATALINA_HOME
JAVA_HOME=/opt/jdk1.6.0_25
export JAVA_HOME
TOMCAT_OWNER=tomcat
export TOMCAT_OWNER
JAVA_OPTS=”-Djava.awt.headless=true -Dfile.encoding=UTF-8
-server -Xms768m -Xmx768m
-XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m
-XX:MaxPermSize=256m -XX:+DisableExplicitGC”
export JAVA_OPTS

start() {
echo -n “Starting Tomcat: ”
su $TOMCAT_OWNER -c $CATALINA_HOME/bin/startup.sh
}
stop() {
echo -n “Stopping Tomcat: ”
su $TOMCAT_OWNER -c $CATALINA_HOME/bin/shutdown.sh
}

case “$1″ in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $”Usage: tomcat {start|stop|restart}”
exit
esac