Monday, August 16, 2010

Running multiple Tomcat 6 instances in Ubuntu, the quick and dirty way

Here's a quick list for running multiple Tomcat 6 instances on Ubuntu 10.04 :

  • Copy the /etc/init.d/tomcat script with a new name in the same directory

  • Update the NAME variable in the startup script with a name for the new instance that you want to run.

  • Copy /usr/share/$(old)NAME to the (new) NAME you've just created, along with /var/lib/$(old)NAME and /etc/default/$(old)NAME

  • Edit the server.xml file under /var/lib/$(new)NAME/conf/ and change all the ports (ie for shutdown, and all your Connectors) so that they don't conflict with the old instance

  • Run /etc/init.d/$(new tomcat script name) start


You should now have a running, fully functional instance of Tomcat on the server, using a different port.

2 comments:

pakman said...

Mmm... /var/lib/tomcat6 has sym links to other places, so I don't think that just copying it will do.

Sandeep said...

I have written a Java based portable utility for automating the above steps for creating multiple instances. Since Java is platform independent, this utility works on all operating systems