I finally got around to updating my Debian scripts for installing multiple instances of Tomcat on the same box. This time around I decided to go ahead and make some .deb packages and really do things the right way.
At this point I'm looking for beta testers to help work out the bugs and then I'll be submitting these packages upstream as well as to Ubuntu for consideration. I'll also be creating a repository in the near future to allow them to be installed via apt.
First, let me start by addressing the issues I've battled with on all Linux varieties for years:
- No distro correctly package Tomcat. Most of them don't include the same JAR files that the Tomcat bundles you download from Apache do. The most severe issue is the commons-dbcp.jar and commons-pool.jar re-package into tomcat-dbcp.jar.
- The package that all Linux distros use is really messy and scatters things all over the file system. Very annoying
- Trying to change the installation to allow for multiple instances that all get started using /etc/init.d scripts all with separate CATALINA_HOME and CATALINA_BASE directories is extremely painful
My object is to allow you to install a base set of packages and then use some super-user scripts to create new instances of Tomcat. Each instance should be completely separate from the others and it should have these things:
- Its own CATALINA_HOME so that you can drop jar files specifically for that application and they won't conflict with other applications
- Its own CATALINA_BASE, which is the same as the CATALINA_HOME to make life simple
- Its own log directory separate from all the others so that log harvesting is simpler
Okay, on to the good stuff. First, if you want to install these packages, you'll need to use dpkg for now, until I get my repository setup. Grab the packages from here:
http://www.inversoft.org/libtomcat6-java.deb
http://www.inversoft.org/tomcat6-multiple-instances.deb
Next, follow these steps to install them from the terminal:
Code:
$ sudo dpkg -i libtomcat6-java.deb
$ sudo apt-get install -f
$ sudo dpkg -i tomcat6-mulitple-instances.deb
$ sudo apt-get install -f
This will install the two packages and all their dependencies. Next, test out the scripts that let you create and remove Tomcat instances. These scripts are executed like this:
Code:
$ sudo /usr/sbin/tomcat6-new-instance
or
$ sudo /usr/sbin/tomcat6-rm-instance
Executing the command will give you information about how they work. After you create the instance, you might have to tweak the Apache2 configuration and the Tomcat configuration for your instance. The directories below will tell you where those files are.
Lastly, there are a few locations that you will want to know about as you beta test:
- /usr/share/tomcat6/skel - This is the location that contains the template used to create new instances
- /var/lib/tomcat6 - This directory will contain each instance
- /var/lib/tomcat6/<domain>/conf/server.xml - This is the Tomcat configuration file for the Tomcat instance for <domain>
- /var/log/tomcat6 - This directory will contain the logs for each instance
- /etc/init.d/tomcat6-<domain> - This is the start up script for a single instance whose domain name is <domain>
- /etc/apache2/sites-available/<domain> - This is the Apache2 configuration file for the Tomcat instance for <domain>
- /etc/libapache2-mod-jk/workers.properties - If you are setting up Mod-JK, the tomcat6-new-instance script will add the Mod-JK settings into this file
Feel free to comment on this thread with any issues or concerns. Also, email me directly or send me private messages through the forums (I'm assuming this is supported here).
Bookmarks