How to setup Apache Tomcat 5.5 on Debian Etch
Posted by Admin on November 27th, 2007
If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!
First Sun JDK 5 need to be installed. It can be installed from Debian repository with unstable software
First you need to edit /etc/apt/sources.list file
#vi /etc/apt/sources.list
Add the following lines
# for sun-java packages in unstable
deb http://ftp.debian.org/debian/ unstable non-free
deb-src http://ftp.debian.org/debian/ unstable non-free
Save and exit the file.
Now you need to Update apt using the following command
#apt-get update
Install jdk using the following command
#apt-get install sun-java5-jdk
Check the java version using the following command
#java -version
Output looks similar to the following
java version “1.5.0_10″
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_10-b03)
Java HotSpot(TM) Client VM (build 1.5.0_10-b03, mixed mode, sharing)
Installing Apache Tomcat
Install Tomcat using the following commands
#apt-get install tomcat5.5
#apt-get install tomcat5.5-admin
#apt-get install tomcat5.5-webapps
To verify that Tomcat is running just navigate to http://localhost:8180/ in your browser (make sure you have replaced ‘localhost’ with your server ip or name)
You can start/stop or restart Tomcat using following command:
#/etc/init.d/tomcat5.5 [start | stop | restart]
Configuring ‘admin’ and ‘manager’ applications
You need to configure some user to have admin and manager roles. For example you can do it with ‘tomcat’ user. Stop server using the following command.
#/etc/init.d/tomcat5.5 stop
Now you need to edit /var/lib/tomcat5.5/conf/tomcat-users.xml file to look like below
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="admin"/>
<role rolename="manager"/>
<role rolename="tomcat"/>
<user username="tomcat"
password=”tomcatpassword”
roles="tomcat,admin,manager"/>
</tomcat-users>
Save and exit the file.
Start tomcat using the following command
#/etc/init.d/tomcat5.5 start
Now you can use manager application at http://localhost:8180/manager/html.
Your user will be ‘tomcat’ and password will be ‘tomcatpassword’


January 17th, 2008 at 5:30 pm
I followded those instructions and was able to run tomcat admin/manager (great!!!).
But when I deployed my web app, the app failed to start. The only error I can see in catalina.log is:
SEVERE: Error listenerStart
How can I get more details about what causes the failure???
Thanks!
-Yong
September 21st, 2008 at 9:20 pm
Great job. It worked.
Thanx.
October 18th, 2008 at 12:32 am
Thank you for making it SUPER easy to set up my Linux server!
This page alone saved me heaps of headaches
October 28th, 2008 at 11:04 pm
I would like to annotate that althoug this solution works to get your admin-page, you will not be able to deploy war-archives to the server. To be able to do that, you will have to modify the file “/etc/tomcat5.5/policy.d/04webapps.policy” and find the following block:
grant codeBase “file:${catalina.home}/bin/tomcat-juli.jar” {
//some permissions here
[...]
};
then you add the followin line to the other permissions in the block and fill in your webapps name:
permission java.io.FilePermission “/var/lib/tomcat5.5/webapps/<>/WEB-INF/classes/logging.properties”, “read”;
This is a nasty task and took me quite a few hours on “grepping” through logfiles and googling. It should be done automatically by tomcat. Has anyone a better solution? I’m still a novice in this J2EE thing.
Greets.
October 28th, 2008 at 11:06 pm
seems like the doubled angle brackets where interpreted as comments or something. You have to insert your webapps name between ““/var/lib/tomcat5.5/webapps/” and “/WEB-INF/classes/logging.properties”
November 18th, 2008 at 9:23 pm
Thanks,
Piece of cake with this HowTo
December 24th, 2008 at 2:24 pm
I hava searched for many websites to install the tomcat to my Ubuntu8.04 before I seen your page ,but all fail ! Then I do as your says ,now ,I finally can open the page “http://localhost:8180″ ,Thank you very much ! Good luck with you ! The late success is exciting !!!!!!!!
January 13th, 2009 at 12:05 pm
Ps. tomcat had problems with your tomcat-user.xml file. My /var/lib/tomcat5.5/conf/tomcat-users.xml looks like:
User ad can then login to both the admin and the manager part of tomcat.
See http://www.netadmintools.com/art340.html
January 26th, 2009 at 12:13 pm
Thanks very very much!
January 29th, 2009 at 1:40 pm
Hi,
I just installed tomcat5.5 on debian server 40r6, with:
aptitude install sun-java5-jre
aptitude install tomcat5.5 tomcat5.5-admin tomcat5.5-webapps
It is then available from http://localhost:8180/, as well as the Tomcat Manager (http://localhost:8180/manager/html). So far, so good.
Then I create a dummy HTML file I want to see when calling http://localhost:8180/foo.html, I have to put it there:
/usr/share/tomcat5.5-webapps/ROOT/foo.html
If I put a WAR file in this directory, it is automatically expanded:
/var/lib/tomcat5.5/webapps/
BUT the problem is that:
1. it does not show up in the “Tomcat Web Application Manager” page
2. it is not reachable by http://localhost:8180/
If I deploy a WAR using the “Tomcat Web Application Manager”, it is then available in /var/lib/tomcat5.5/webapps, but not shown in the Manager page.
What’s the problem?
It seems I have 2 webapps directories, instead of one.
How can I solve that?
Thanks
March 6th, 2009 at 5:00 am
Yann, I had the same problem. If you look at the catalina log file you see a logging.properties exception when tomcat is trying to load your app. The fix is described by brndnbg above.
May 1st, 2009 at 8:12 am
hi
very good, wonderfull, you do help me
thanks
May 28th, 2009 at 1:51 pm
you may need #chmod +x -R tomcat5.5/