HOW TO INSTALL TOMCAT 6 IN CentOS

1) Download JDK and JRE : http://www.oracle.com/technetwork/java/javase/downloads/index.html

For 64 bit server: jdk-6u24-linux-x64.bin
For 32 bit server: jdk-6u24-linux-i586.bin

2) [root@xxx]# mv jdk-6u24-linux-x64.bin /opt
[root@xxx]# mv jre-6u24-linux-x64.bin /opt

3) [root@xxx]# mkdir /usr/java

4) [root@xxx]# cd /usr/java

5) [root@xxx]# sh /opt/jdk-6u24-linux-x64.bin
[root@xxx]# sh /opt/jre-6u24-linux-x64.bin

6) Set profile:

#vi /etc/profile:

JAVA_HOME=/usr/java/jdk1.6.0_24
export JAVA_HOME
JAVA_OPTS="-d64 -server -Xms256m -Xmx16384m -XX:MaxPermSize=1024m"
export JAVA_OPTS
CATALINA_OPTS="-Djava.awt.headless=true"
export CATALINA_OPTS
#CATALINA_OPTS="-verbose:gc -XX:+PrintGCTimeStamps -XX:+PrintGCDetails
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8999
-Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
-Djava.rmi.server.hostname=localhost
-Djava.awt.headless=true"
#export CATALINA_OPTS
PATH=$JAVA_HOME/bin:$PATH
export PATH
CATALINA_HOME=/usr/share/apache-tomcat-6.0.30
export CATALINA_HOME
TOMCAT_HOME=$CATALINA_HOME/bin
export TOMCAT_HOME
HISTTIMEFORMAT=":%c:"
export HISTTIMEFORMAT

-SAVE and QUIT-

LOGOUT FROM THE SYSTEM TO ACTIVATE THE CURRENT PROFILE!!!

TEST:

[root@xxx]# echo $JAVA_HOME
/usr/java/jdk1.6.0_24

7) Download and install tomcat 6
Download apache-tomcat-6.0.30 @ http://tomcat.apache.org/download-60.cgi

8)[root@xxx]# md5sum apache-tomcat-6.0.30.tar.gz

9)[root@xxx]# mv apache-tomcat-6.0.30.tar.gz /usr/share

10) [root@xxx]# cd /usr/share

11) [root@xxx]# tar -zxf apache-tomcat-6.0.30.tar.gz

let it install by itself

12)TO TEST THE TOMCAT INSTALLATION SUCCESSFULLY DONE:
[root@xxx]# cd /usr/share/apache-tomcat-6.0.30/bin
[root@xxx]# ./startup.sh --> cat image (tomcat welcoming page) should be displayed

13) HOW TO RUN TOMCAT AS A SERVICE

[root@xxx]# cd /etc/rc.d/init.d
[root@xxx]# vi tomcatroot

#!/bin/bash
# description: Tomcat Start Stop Restart
# processname: tomcat
# chkconfig: 234 20 80

JAVA_HOME=/usr/java/jdk1.6.0_24
export JAVA_HOME
JAVA_OPTS="-d64 -server -Xms256m -Xmx16384m -XX:MaxPermSize=1024m"
export JAVA_OPTS
CATALINA_OPTS="-Djava.awt.headless=true"
export CATALINA_OPTS
#CATALINA_OPTS="-verbose:gc -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -Dcom.sun
.management.jmxremote -Dcom.sun.management.jmxremote.port=8999 -Dcom.sun.managem
ent.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava
.rmi.server.hostname=localhost -Djava.awt.headless=true"
#export CATALINA_OPTS
PATH=$JAVA_HOME/bin:$PATH
export PATH
CATALINA_HOME=/usr/share/apache-tomcat-6.0.30
export CATALINA_HOME
TOMCAT_HOME=$CATALINA_HOME/bin
export TOMCAT_HOME

case $1 in
start)
sh $CATALINA_HOME/bin/startup.sh
;;
stop)
sh $CATALINA_HOME/bin/shutdown.sh
;;
restart)
sh $CATALINA_HOME/bin/shutdown.sh
killall -9 java
sh $CATALINA_HOME/bin/startup.sh
;;
esac
exit 0

-SAVE AND QUIT-

14) [root@xxx]# chmod 755 tomcatroot -->permission for executeable

15)[root@xxx]# chkconfig --add tomcatroot


16)[root@xxx]# chkconfig --level 2345 tomcatroot


17)[root@xxx]# chkconfig --list tomcatroot

TO RUN THE TOMCAT SERVICE
18) [root@xxx]# service tomcatroot start|stop|restart|

HOW TO RUN TOMCAT AS NON-ROOT USER

1) [root@xxx]# groupadd tomcat -->group:tomcat,user:black

2) [root@xxx]# useradd -g tomcat -d /usr/share/apache-tomcat-6.0.30/black black

3) [root@xxx]# chown -Rf black.tomcat /usr/share/apache-tomcat-6.0.30


HOW TO INSTALL LAMBDA PROBE (monitoring tools for tomcat)
_________________________________________________________

1) Go to: http://www.lambdaprobe.org/d/download.htm;jsessionid=E705E7AE96812AB8F390BF6454CBE15E
download --> probe.1.7b.zip

2) INSTALL

Installing manually

* Download Lambda Probe .war file
* Shutdown Tomcat if it is running
* Copy probe.war to $CATALINA_HOME/webapps/
* Start Tomcat

3) Edit tomcat-users.xml:

under insert the following;








---> This line: to access tomcat manager




4) Save and restart tomcat

5) Open your browser, type: http://localhost/probe