In order to install Tomcat on Centos Server With Apache.. You need to install jdk on the server you can get the details of the same by Clicking

Create a directory

mkdir -p /usr/java
 
cd /usr/java

Downlad the binery / package

wget –no-cookies –header “Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com” “http://download.oracle.com/otn-pub/java/jdk/7u17-b02/jdk-7u17-linux-x64.tar.gz”
 
mv jdk-7u17-linux-x64.tar.gz?AuthParam=1363436141_50e25f2788e6791ab07cc3161569c719 jdk-7u17-linux-x64.tar.gz
 
tar -xzvf jdk-7u17-linux-x64.tar.gz

cd jdk1.7.0_17

vi ~/.bash_profile

Write below details in the bask_profile

export PATH
export JAVA_HOME=/usr/java/jdk1.7.0_17
export PATH=$JAVA_HOME/bin:$PATH
export PATH=$PATH:$JAVA_HOME/bin

Use following command to activate the path settings immediately:

source ~/.bash_profile

To check the JAVA_HOME settings use

echo $JAVA_HOME

Now we can begin with the tomcat installations lets say we wish to keep the installation in /etc directory

cd /etc

Download the package

wget http://apache.techartifact.com/mirror/tomcat/tomcat-6/v6.0.36/bin/apache-tomcat-6.0.36.tar.gz

Or else you may check http://tomcat.apache.org/download-60.cgi

Extract the packages tar -xzvf apache-tomcat-6.0.36.tar.gz

mv apache-tomcat-6.0.36 tomcat6
 
cd tomcat6
 
cd conf

Open the script

vi catalina.sh

and write JAVA_HOME variable

JAVA_HOME=/usr/java/jdk1.7.0_17

To start and stop the tomcat6 we can create the following script in init.d

vi /etc/init.d/tomcat6
 

#!/bin/bash
# chkconfig: 234 20 80
# description: Tomcat Server basic start/shutdown script
# processname: tomcat
JAVA_HOME=/usr/java/jdk1.7.0_17
export JAVA_HOME
TOMCAT_HOME=/etc/tomcat6/bin
START_TOMCAT=/etc/tomcat6/bin/startup.sh
STOP_TOMCAT=/etc/tomcat6/bin/shutdown.sh
start() {
echo -n “Starting tomcat: “
cd $TOMCAT_HOME
${START_TOMCAT}
echo “done.”
}
stop() {
echo -n “Shutting down tomcat: “
cd $TOMCAT_HOME
${STOP_TOMCAT}
echo “done.”
}
case “$1” in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 10
start
;;
*)
echo “Usage: $0 {start|stop|restart}”
esac
exit 0
 
chmod 755 /etc/init.d/tomcat6
 

Now for accessing tomcat manager set the password for tomcat user

passwd tomcat

******

Now lets specify the user details in tomcat configuration

Open a file /etc/tomcat6/conf/tomcat-users.xml

Add below lines

<role rolename=”manager”/>
<role rolename=”manager-gui”/>
<role rolename=”admin”/>
<user username=”tomcat” password=”******” roles=”admin,manager,manager-gui”/>
 
And you can access the tomcat manager at the URL :: http://serverip:8080/manager/html

🙂