Child pages
  • Tomcat-6 Ubuntu LTS Package
Skip to end of metadata
Go to start of metadata


Brian Pontarelli started an Ubuntu bug here which aims to

  • replace the current debian/ubuntu tomcat packages
  • introduce a mechanism to administer multiple tomcat instances on a single server


Initial packages based off of the original binary Tomcat-6.0.20 release from the project homepage have been built and uploaded. A tomcat6-server package has been created that contains all necessary files and scripts to handle multiple parallel tomcat instances on a server.
The new packages have been tested with Ubuntu 8.04 LTS with both the sun-java-1.5 and openjdk-6 jdks.


The tomcat6-server package contains the following files and scripts:

`- init.d                                          
|  `- tomcat_control_instance                     
|- bin
|  `-
`- share
   |- doc
   |   `- tomcat6-server
   |      |- changelog.Debian.gz
   |      `- copyright
   `- tomcat6-server
     `- skel
       `-- conf
           |- context.xml
           |- server.xml
           |- tomcat-users.xml
           `- web.xml
  • this script generates/deletes instances
  • tomcat_control_instance: a modified initscript which is operated by symlinking the name of an instance to it
  • skel-files: plus some files to populate the new instance with

Call the script with the '-h' parameter to view its options. It tries to find out available ip's to bind to via 'iproute' and available jvms via 'update-java-alternatives. Notice the '-n' paramater which will only 'echo' out all commands that will be executed without modifying the system.

~# -h

 This script will generate all necessary prerequisites for a new
 Tomcat instance. Either specify:                               

 * Mandatory:
 -C [create] 
 -T [version]   Version of tomcat to use. Either tomcat5.5 or tomcat6.
 -I [instance]  Name of the instance. Will generate a tomcat[5.5|6]-[instance] symlink in /etc/init.d to control it.
 -a [ajp-port]  Port of the AJP Connector, standard Tomcat binds to 8009 so please choose something else.           
 -i [address]   IP address to bind the new instance to. Available IPs are:                                          

 -j [java-vm]   Java virtual machine to use for instance. Available JVMs are:

 -p [http-port] Port to bind the new instance to, standard Tomcat binds to 8180 so please choose something else.
 -s [shut-port] Port used to send shutdown command, standard Tomcat binds to 8005 so please choose something else.

 * Optional:
 -u [user]      Specifiy the user under which tomcat will run. Defaults to 'tomcat6'.
 -g [group]     Specifiy the group under which tomcat will run. Defaults to 'nogroup'.
 -x [Xms-Mem]   JVM Xms-Memory limit in megabytes, defaults to 256.
 -y [Xmx-Mem]   JVM Xms-Memory limit in megabytes, defaults to 1024.
 -z [PS-Mem]    JVM Permission space memory limit in megabytes, defaults to 128.


 -D [destroy]
 -T [version]   Version of tomcat to use. Either tomcat5.5 or tomcat6.
 -I [instance]  Name of the instance to destroy.
                WARNING: Will delete the instance 'config' and 'webapps' folders!

 -n [dry-run]   Show what would be done.
 -h [help]      Show this crap.

  • Create an instance:
    ~# -C -I test -T tomcat6 -i -j /usr/lib/jvm/java-1.5.0-sun -a 8010 -p 8181 -s 8006 -x 128 -y 512 -z 64

    This would create an instance called 'tomcat6-test', generating the following files, links and folders:
    `- default
    |  `- tomcat6-test
    `- init.d
    |  `- tomcat6-test -> tomcat_control_instance
    `- tomcat6-test
    |  `- [conf files]
    |     `- ...
    `- lib
    |  `- tomcat6-test
    |     `- {webapps}
    `- log
       `- tomcat6-test
          `- {logs}

    /etc/init.d/tomcat6-test: link to the new init script 'tomcat_control_instance'
    /var/lib/tomcat6-test: deploy your webapp here
    /var/log/tomcat6-test: all the instances logfiles go here
    /etc/default/tomcat6-test: controls basic JAVA_OPTS, JVM type, tomcat security manager and so on. Would look like this:
    JAVA_OPTS="-Djava.awt.headless=true -Xms128m -Xmx512m -XX:MaxPermSize=64m -Dfile.encoding=UTF-8"

  • Remove an instance:
    ~# -D -I test -T tomcat6


  • Rework instance script
    • still based on my original tomcat5.5 multi instance script
    • does not use @HOST_NAME@ variable at the moment
  • package/file layout
  • package dependencies might be wrong (question)
  • do we need to split tomcat into 9 packages?

Links and Downloads

Discussion on that topic can also be found on the Ubuntu Forums.

Brian's project is currently hosted on Google Code and this page.

Packages built by me are currently located at my storage server.