Archive for 4 octubre 2009

How to setup Tomcat 6 on Debian Unstable for normal usage

octubre 4, 2009

Update: 9 / November / 2009

Finally I have installed a manual Tomcat tar.gz binary from the Tomcat webpage in my user directory. I start it with the start script bundled in the directory and that’s it. For my studies I do not need even to set up it as a daemon.


Have you installed the tomcat6 package on your Debian Unstable distribution (2009/10/04).
Do you know where your webapps directory is?
Do you know how to activate the war-file deployment?
No? Neither did I!
Here there are some steps to finish setting up Tomcat6 on Debian Unstable.
Remember to backup any file that you modify just in case.

Setting up Webapp policy

You need to edit /etc/tomcat6/policy.d/04webapps.policy
At its bottom you will see something as:
permission java.util.PropertyPermission "", "read";
permission "${}/-", "read,write,delete";
You just have to add the following line before the }; .
permission "/etc/tomcat6/", "read";
So that you finally have:
permission java.util.PropertyPermission "", "read";
permission "${}/-", "read,write,delete";
permission "/etc/tomcat6/", "read";

Setting up Webapp root directory

We need to edit: /etc/tomcat6/server.xml file.
Let’s focus on:
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
Just substitute webapps with the webapps folder that you want to use. I have used what seems to me the default one in Debian: /usr/share/tomcat6/webapps/default_root/.
So you will have:
<Host name="localhost" appBase="/usr/share/tomcat6/webapps/default_root"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">

Setting up Tomcat6 permissions on webapp root folder

Finally we need to give the user tomcat6 permissions on the webapp root folder.
We just issue the following command:
chown tomcat6:tomcat6 /usr/share/tomcat6/webapps/default_root

Testing Tomcat

If everything is ok we can try to copy a .war file at /usr/share/tomcat6/webapps/default_root and check the same folder some seconds later for checking its deployment.
Remember that if there is any problem you can always check the log files at: /var/log/tomcat6/ folder.

About default index

I do not know why but getting to default index.html does not work anymore. However if I try to set up /usr/share/tomcat6/webapps as the default webapps root then checking default_root/index.html at the browser does work!. I am not worried about that.