Tomcat 6 Ubuntu install for multiple instances

Posted by Jerzy Seweryn on
Install SUN JAVA6 JDK
[code lang="shell"]
[email protected] apt-get install sun-java6-jdk
[/code]
Install TOMCAT6 user instances
[code lang="shell"]
[email protected]: apt-get install tomcat6-user
[/code]
Add new user:
[code lang="shell"]
[email protected]: adduser tomcatA
[/code]
Create TOMCAT6 user instance:
[code lang="shell"]
[email protected]: tomcat6-instance-create tomcat
[/code]
Tomcat configure(port):
[code lang="shell"]
[email protected]: vim tomcat/conf/server.xml
[/code]
Tomcat start/stop:
[code lang="shell"]
[email protected]: ./tomcat/bin/startup.sh
[email protected]: ./tomcat/bin/shutdown.sh
[/code]
Add to autostart:
[code lang="shell"]
[email protected]: vim /etc/init.d/tomcatA
#!/bin/bash
# Tomcat auto-start
#
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid

export JAVA_HOME=/usr/lib/jvm/java-6-sun

case $1 in
start)
sudo -u tomcatA /home/tomcatA/tomcat/bin/startup.sh
;;
stop)
sudo -u tomcatA /home/tomcatA/tomcat/bin/shutdown.sh
;;
restart)
sudo -u tomcatA /home/tomcatA/tomcat/bin/shutdown.sh
sudo -u tomcatA /home/tomcatA/tomcat/bin/startup.sh
;;
esac
exit 0
[/code]
[code lang="shell"]
[email protected]: chmod +x /etc/init.d/tomcatA
[/code]
Update init.d scripts
[code lang="shell"]
sudo update-rc.d tomcatA defaults
[/code]