How to Install Tomcat on Linux?

How to setup Apache Tomcat on Linux?

http://java.sun.com/j2se/1.4.2/download.html download the "self-extracting file"

Open new shell type su to login as root


#su
#chmod +x j2sdk-1_4_2_09-linux-i586.bin
#./j2sdk-1_4_2_09-linux-i586.bin

press enter till finish the agreement and type y to start installation. you will find it installed in your home directory


#export JAVA_HOME=/home/hashim/j2sdk1.4.2_09/
#export PATH=${JAVA_HOME}/bin

replace the directory above with the correct directory according to your system.

if you want to know the current java version type

#java -version
you should see


Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_09-b05)
Java HotSpot(TM) Client VM (build 1.4.2_09-b05, mixed mode)

http://jakarta.apache.org/site/downloads/downloads_tomcat-5.cgi download version 5.0.28 to be compatible with JDK 1.4.2 because the latest versions of tomcat require JDK5

http://ftp.wayne.edu/apache/jakarta/tomcat-5/v5.0.28/bin/jakarta-tomcat-5.0.28.tar.gz

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


#cd jakarta-tomcat-5.0.28
#cd bin
#tar xvfz jsvc.tar.gz
#cd jsvc-src
#chmod +x configure
#./configure
#make
#cp jsvc ..
#cd ..

#./startup.sh

open web browser and type http://localhost:8080/ you should see the Tomcat Administration page

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

 Hello Tomcat

open the URL http://localhost:8080/hello.html you should see your page

go to webapps/ROOT in the tomcat directory and create page hello.jsp and write in it the following lines


 < %=new String("Hello Ahmed Hashim")% >
<br>
< %=new java.util.Date()% >
<br>

save and run the following URL http://localhost:8080/hello.jsp you should see my Name

you can see the log file in the logs directory

go to the tomcat bin directory

#./shutdown.sh

Note:- I can see that Tomcat on Linux faster that tomcat in windows at least 3 times in both startup, shutdown and in compiling.