How to install several Tomcat instances on Ubuntu?
I need to have two instances of Tomcat 6 running on Ubuntu 10.04. I know it should be doable pretty simply by something like:
- copy /var/lib/tomcat6 to /var/lib/tomcat6-2
- modify ports in /var/lib/tomcat6-2/conf/server.xml
- copy /etc/init.d/tomcat6 to /etc/init.d/tomcat6-2
- modify /etc/init.d/tomcat6-2...
...but my problem is that I'm unsure what I should modify in /etc/init.d/tomcat6-2. Changing the NAME in the beginning of the file clearly is not enough.
(I'm aware that there is tomcat6-new-instance but I don't want to create instances for users.)
You can follow the directives here http://blog.tartachuc.org/2012/01/18/plusieurs-instances-de-tomcat-sur-ubuntu/
There is an ubuntu package called tomcat6-user
and tomcat7-user
which gives the command tomcat6-instance-create
and tomcat7-instance-create
with which you can create other instances of Tomcat.
I have had to do this and found the simplest solution to be this.
Give it a once over and see if this is what your after.
Running multiple tomcat by using a single
catalina_base
andcatalina_home
.This will make it easy to manage server management to use only one tomcat setup instance
Download tomcat-6+ and unpack it. Modify two configuration files under
conf
:server.xml
replace ports & access log and cluster instance name with variables like:
<Server port="${tomcat.server.port}1" shutdown="SHUTDOWN">... <Connector port="${tomcat.server.port}2" protocol="HTTP/1.1"
connectionTimeout="20000" redirectPort="8443" />...
catalina.properties
change log file prefix like
1catalina.org.apache.juli.FileHandler.prefix = ${tomcat.server.port}.catalina
and before you run the command you should set 2 environment variables for each instance like
set JAVA_OPTS=-Dtomcat.server.port=810 set CATALINA_TMPDIR=%cd%..work810 catalina run set JAVA_OPTS=-Dtomcat.server.port=820 set CATALINA_TMPDIR=%cd%..work820 catalina run