- Debian Admin - http://www.debianadmin.com -

How to setup Apache Tomcat 5.5 on Debian Etch

Posted By Admin On 27th November 2007 @ 00:29 In Webserver | 1 Comment

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’

Tags: , , , ,

You may also be interested in...


Article printed from Debian Admin: http://www.debianadmin.com

URL to article: http://www.debianadmin.com/how-to-setup-apache-tomcat-55-on-debian-etch.html

Click here to print.