Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there a proper way to run more than one tomcat instance on an Ubuntu server?

I've done some searching and found two options:

  1. Download a zipped tomcat and manually deploy it. The obvious con is that it won't be upgraded using apt-get.
  2. Use some advanced scripting, which is dangerous in a production server.

Any other ideas to cleanly run another instance?

Thanks in advance,

Adam

share|improve this question
    
why do you need more than one instance? –  cupakob Nov 14 '10 at 10:57
add comment

3 Answers 3

up vote 2 down vote accepted

Scripting seems to be the best solution because defaut ubuntu server configuration is for one instance only.

As you noticed, you must update Tomcat manually, but this is not necessary a problem because, often your Java applications depend on a particular JDK version so upgrade process must be done carefully especially on a production server.

share|improve this answer
add comment

Have you considered configuring several webapps directories instead of running multiple tomcat instances?

Of course there are cases where you really need multiple instances but in case of serving same application separately for multiple hosts, you may do it by adding multiple declarations in server.xml:

  <Host name="host1.example.com" appBase="host1"
    unpackWARs="true" autoDeploy="true" 
    xmlValidation="false" xmlNamespaceAware="false" />

  <Host name="host2.example.com" appBase="host2"
    unpackWARs="true" autoDeploy="true" 
    xmlValidation="false" xmlNamespaceAware="false" />

Now you may create "/var/lib/tomcat6/host1" and "/var/lib/tomcat6/host2" directories and deploy WAR files to them.

share|improve this answer
add comment

One way you can do it is by using GNU Screen . But, if you need to run them as services that auto-start using the Init system, then you need to script it using "nohup" and "&" .

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.