Category: Tomcat web server

Tomcat web server

How to install Tomcat on Linux

How to install Tomcat on Linux

What is Tomcat –

Tomcat is the servlet container, which implements the Java Servlet and the JavaServer Pages (JSP) specifications from Sun Microsystem.  Tomcat is pure HTTP web server for Java based appicatio.

How to install –

1) Download java –

Go to choose your platform and follow the steps on the site.

2) Installing the binaries
The installation of the Java Developer’s Kit is pretty straightforward if if you retrieve the RPM for it. If you have to download the RPM from Sun’s site, it isn’t acutally in RPM format yet. It’ll be called something like j2sdk-xxx-linux-rpm.bin. chmod 700 it and execute it. This will run the Sun EULA and after you agree to it, generate the actual RPM file.

Execute the binary –  chmod +x jdk-xxx-linux-i586-rpm.bin

After the RPM is produced, install it simply by running rpm -ivh jdk-xxx-linux-i586-rpm. This will install the JDK in /usr/java/jdk.x.x.  You need to modify the user’s .bash_profile to include /usr/java/jdk/bin in the path so the executables will run. What I usually do is make a symbolic link called /usr/java/jdk that points to this /usr/java/jdk.x.x. That way I don’t have to update my path in the .bash_profile every time I install a new version of the JDK.

You should also set your JAVA_HOME in the .bash_profile with something like  export JAVA_HOME=/usr/java/jdk
or on bash promt of user

[root@localhost]# JAVA_HOME=/usr/java/jdk  ;  export JAVA_HOME

Download the latest stable release of tomcat from

after downloading apache-tomcat-5.x.x.tar.gz extract it into /usr/local/

Installing the binaries
cd /usr/local

tar -xvzf apache-tomcat-5.x.x.tar.gz

cd apache-tomcat-5.x.x

cd bin

rm *.bat

To enable the Tomcat manager, you need to modify /usr/local/apache-tomcat-5.x.x/conf/tomcat-users.xml add a user »admin« or with the role »manager«. The result should look like this:

<?xml version=’1.0′ encoding=’utf-8′?>
<role rolename=”manager”/>
<role rolename=”tomcat”/>
<role rolename=”role1″/>
<user username=”both” password=”tomcat” roles=”tomcat,role1″/>
<user username=”tomcat” password=”tomcat” roles=”tomcat”/>
<user username=”admin” password=”password” roles=”manager”/>
<user username=”role1″ password=”tomcat” roles=”role1″/>

Now you should be able to startup tomcat –

/bin/sh /usr/local/apache-tomcat-5.x.x/bin/

You should now be able to connect to: http://localhost:8080/index.jsp


Ravi Bhure