Debian Admin

Debian/Ubuntu Linux System Administration Tutorials,Howtos,Tips

  • RSS Subscribe

    subscribe to the Debian Admin RSS feed
  • Sponsors



  • Categories

  • Sponsors

  • Support DebianAdmin

    Amount $:
    Website(Optional):


  • Meta

  • Archives



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!

Apache Tomcat is a web container, or application server developed at the Apache Software Foundation (ASF). Tomcat implements the servlet and the JavaServer Pages (JSP) specifications from Sun Microsystems, providing an environment for Java code to run in cooperation with a web server. It adds tools for configuration and management but can also be configured by editing configuration files that are normally XML-formatted. Tomcat includes its own internal HTTP server.

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’

  • Share/Save/Bookmark

13 Responses to “How to setup Apache Tomcat 5.5 on Debian Etch”

  1. Yong Says:

    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

  2. Miguel Says:

    Great job. It worked.

    Thanx.

  3. Ann Says:

    Thank you for making it SUPER easy to set up my Linux server!
    This page alone saved me heaps of headaches

  4. brndnbg Says:

    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.

  5. brndnbg Says:

    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” ;-)

  6. pj Says:

    Thanks,

    Piece of cake with this HowTo

  7. Thanks Says:

    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 !!!!!!!!

  8. Kees Says:

    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

  9. Kasidit Says:

    Thanks very very much!

  10. Yann Says:

    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

  11. Stacy Says:

    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.

  12. zito Says:

    hi

    very good, wonderfull, you do help me

    thanks

  13. akram Says:

    you may need #chmod +x -R tomcat5.5/

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>