Install JAVA Tomcat on Linux

Installation of Java

Login to server as root
# cd /opt

Download jdk 6 linux rpm bin package from sun (Java SE Development Kit (JDK))
http://java.sun.com/javase/downloads/index.jsp
http://java.sun.com/javase/downloads/widget/jdk6.jsp

# chmod 777 jdk-6u17-linux-i586-rpm.bin
# ./jdk-6u17-linux-i586-rpm.bin

Follow the onscreen instructions to complete jdk installation…. press space ….. press yes….. and Enter

Now we will find JDK folder at /usr/java/jdk1.6.0_17

Installation TomCat

Download tomcat source files and extract…

# wget http://www.trieuvan.com/apache/tomcat/tomcat-6/v6.0.20/bin/apache-tomcat-6.0.20.tar.gz
# tar xzf apache-tomcat-6.0.20.tar.gz
# ls

Move tomcat to /usr/java/tomcat/

# mv apache-tomcat-6.0.20 tomcat
# mv tomcat /usr/java/
# cd /usr/java/tomcat/

Set CLASSPATH for JAVA & TOMCAT

# vi /etc/profile    (set class path)

add source PATH to /etc/profile

export JAVA_HOME=/usr/java/jdk1.6.0_17
export CATALINA_HOME=
/usr/java/tomcat
export PATH=$JAVA_HOME/bin:$PATH

# source /etc/profile

Start tomcat server….

# /usr/java/tomcat/bin/startup.sh

Start/Stop Tomcat

# cd /usr/java/tomcat/bin
# ./shutdown.sh
# ./startup.sh

Check tomcat status

# netstat -ntlp|grep 8080

Enjoy new server 🙂