Go Job Hunting at the LQ Job Marketplace
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


LinkBack Search this Thread
Old 02-05-2013, 07:59 AM   #1
Registered: May 2012
Posts: 33

Rep: Reputation: Disabled
Tomcat directories

Hi all,

i would like to ask if there is any good secure way to separate in a different directory(/usr/local)tomcat configuration directories like /conf, /bin etc and in a separate directory webapp directories like webapss, logs, etc..

thank you very much!

Old 02-05-2013, 08:30 AM   #2
Registered: Mar 2009
Posts: 113

Rep: Reputation: 8
That is the case already, there are two separate directories represented by the $CATALINA_HOME and $CATALINA_BASE variables respectively.
HOME is where your binaries are, while as base has the config of the particular instance as well as the temp work and webapps dirs.
To change $CATALINA_BASE yo will need to modify the environment variable.If you are installing from a package chance are the two are different already at least that is the case with the Debian repo package of Tomcat .Check your init script.There are also the docBase and appBase appBase points deto where the webapps can be found.iirc they are defined in server.XML, and are relative to your $CATALINA_BASE directory.

Last edited by vl23; 02-05-2013 at 08:46 AM.
Old 02-05-2013, 09:31 AM   #3
Registered: May 2012
Posts: 33

Original Poster
Rep: Reputation: Disabled
Tomcat directories

thank you for replying.

I want to put Catalina_Home in another partition like /usr/local/tomcat,
and Catalina_Base into another partition like /opt/tomcat.

can you please specify what changes should i make into the configuration files or init scripts?

Thank you very much,
Old 02-05-2013, 12:10 PM   #4
Registered: Mar 2009
Posts: 113

Rep: Reputation: 8
If you have installed Tomcat from a package and it is running as a service you will have to go to the directory where your init scripts are located and edit your tomcat init script.In the case of Debian squeeze the script is /etc/init.d/tomcat6 but your path and script name might be different.You should first stop tomcat by executing the script with the stop argument.
One important thing, before editing anything make sure you create a backup copy of the script or file you will be editing!!!!
Just find the CATALINA_BASE and CATALINA_HOME variable definitions and modify them to point where your want them.Keep in mind that shell variables commit the $ at the start of the name when defined.
After that move the contents of the old dirs to the new locations cp -Rp * /path/to/destination/dir should do that nicely I think, the trick here is to preserve the ownership and permissions of the stuff while copying it.Also make sure that your new directories have the same ownership and permissions as the old ones, you will also have to create the destinations if they do not exist.I of more information check the man pages for cp and chown.
If you are using a customized setup w/o a setup script you will just have to set those variables for the user under which Tomcat will be running, iirc there was a setenv script that came with Tomcat, that you could edit.Check the Tomcat documentation regarding it.
A user's environmental variables will have to be set in either his .bashrc or .profile file they also have to be exported:
export VARNAME='value' should work.
Then switch to the user and execute echo $VARNAME to check if it is set properly, however that will only work of you are starting it manually without an init script.My advice, if you are using some type of custom setup, Tomcat is starting OK at startup, and you can't locate the script by name go into your distro's equivalent to/etc/init.d and do grep CATALINA * that will get you the file you need.
Some more info about your setup and distro name as well as why you are doing what you are doing will be good.

Last edited by vl23; 02-05-2013 at 12:23 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Session replication using apache+mod_jk+tomcat(5.5.28-veriosn of tomcat) sreejithp Linux - Server 1 12-24-2010 06:46 AM
Tomcat 6.0 on Linux, after modifying tomcat-users.xml still cannot login. cuian01 Linux - Newbie 1 01-28-2010 03:45 AM
fresh tomcat 5.5 install not showing tomcat homepage laggerific Linux - Software 0 10-26-2007 03:28 PM
TOMCAT init script not working on startup -- tomcat 4.x / Mandrake Linux 8.0 jmartinph Mandriva 0 03-08-2004 01:31 AM

All times are GMT -5. The time now is 10:44 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration