Installing Tomcat on Linux
Sunday, September 28th, 2008 | Author: Martin

To install apache tomcat , you need to install jdk (Java Development kit).
Tomcat need JAVA_HOME set properly before prior to operation or installation.
e.g.
JAVA_HOME=/usr/local/jdk
PATH=$JAVA_HOME/bin:$PATH

You can download the installer from
http://archive.apache.org/dist/jakarta/tomcat-5/v5.0.28/bin/jakarta-tomcat-5.0.28.tar.gz

Download version 5.0.28 to be compatible with JDK 1.4.2 because the latest versions of tomcat require JDK5

To extract and install Tomcat run this command:

]# tar xvfz jakarta-tomcat-5.0.28.tar.gz

The Tomcat files are installed in a directory called jakarta-tomcat-5.0.28 in the current directory.

Then you need to set CATALINA_HOME properly prior to start tomcat.

Use following command to set CATALINA_HOME and provide full path of tomcat directory (from toot).

export CATALINA_HOME=/user/local/jakarta/jakarta-tomcat-5.0.28

Run Tomcat

goto bin directory of tomcat
cd /user/local/jakarta/jakarta-tomcat-5.0.28/bin
]# ./startup.sh

Open web browser and type http://your_domain:8080/ you should see the Tomcat Administration page

Test Tomcat

go to webapps/ROOT in the tomcat directory and create page hello_world.html and write in it

Hello World

open the URL http://your_domain:8080/hello_world.html you should see your page.

Test JSP page

go to webapps/ROOT in the tomcat directory and create page test.jsp and write in it the following lines
<html>
<%=new String(“Hello World…”)%>
<br>
<%=new java.util.Date()%>
<br>
</html>

save and run the following URL http://your_domain:8080/test.jsp you should see Hello World.. followed by current date.

Monitor Tomcat

You can see the log file in the logs directory  /user/local/jakarta/jakarta-tomcat-5.0.28/log/

Stop Tomcat

Go to the tomcat bin directory and run command.

]# ./shutdown.sh

Note:- Apache Tomcat on Linux faster that tomcat in Windows at least 2 times in both startup, shutdown and in compiling jsp files.