views:

251

answers:

2

I'm new to Linux, and I don't understand why apt-get install tomcat6 resulted in two tomcat6 folders, one in /var/lib/, the other in /usr/share/. I'm sure there is a good reason for it, but it caused me a few hours confusion with nothing working.

What's the deal?

A: 

/var/lib and .../share directories are for (binary) transient files and platform-independent (text, typically) files respectively. See the Filesystem Hierarchy Standard

Pascal Cuoq
But why the duplication? Why not just /var/lib/tomcat6?
FarmBoy
If a system administrator were to install tomcat6 on a server exporting the application by (say) NFS, in a typical setup, the `/usr` directory would be on the server, and `/var` on each client.
Pascal Cuoq
+1  A: 

Tomcat Provides a mechanism where you can run multiple instances that all utilizes some common configuration elements. You would use the environment variables CATALINA_HOME vs CATALINA_BASE to configure tomcat(or corresponding properties). See this article for an explanation.

"The first properties (catalina.home) points to the location of the common information, while the other property (catalina.base) points to the directory where all the instance specific information are held."

So the default tomcat6 package in Ubuntu has a configuration that is friendly to people who run single instances as well as those who run multiple instances.

You can see that the tomcat6 package includes both:

  • /usr/share/tomcat6
  • /var/lib/tomcat6

If you are only running one instance of tomcat, then you probably want to use the /var/lib/tomcat6 location.

If by chance you(or other readers) are looking for scripts to automate installing multiple instances of Tomcat on a debian based distro, this one has worked well for me with some slight modifications.

Colin Harrington
By default the init script /etc/init.d/tomcat6 sets:CATALINA_HOME=/usr/share/tomcat6CATALINA_BASE=/var/lib/tomcat6
Colin Harrington