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!
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.
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,
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.
|All times are GMT -5. The time now is 09:27 PM.|