A recent attempt to install Tomcat5 through the RPM repositories with the statement yum install tomcat5 failed to be as successful to run the application. Also there is a need to run Tomcat with Sun Java JDK not the openJDK that is available through the channels. These are the steps to get Tomcat up and running on a Red Hat Enterprise Linux 5 (RHEL5) or CentOS 5 (CENTOS5) installation using version 5.4.

Prerequisites
Java - Read my article on how to install Java JDK.

Install Tomcat 5.5.28
Source: http://www.bartbusschots.ie/blog/?p=240

Download Tomcat 5.5.28

wget http://mirror.candidhosting.com/pub/apache/tomcat/tomcat-5/v5.5.28/bin/apache-tomcat-5.5.28.tar.gz

Unpack Tomcat 5.5.28

tar -xzf apache-tomcat-5.5.28.tar.gz
sudo mv apache-tomcat-5.5.28 /usr/local/
cd /usr/local/
ln -s apache-tomcat-5.5.28/ tomcat
cd /usr/local/tomcat/bin
To run with startup.sh, point to JAVA_HOME
gedit catalina.sh
add JAVA_HOME="/usr/java/default"

To run automatically on boot

gedit /etc/init.d/tomcat

Copy and paste the following code. Change JAVA_HOME to your JAVA_HOME.

# This is the init script for starting up the

#  Jakarta Tomcat server

#

# chkconfig: 345 91 10

# description: Starts and stops the Tomcat daemon.

#

# Source function library.

. /etc/rc.d/init.d/functions

# Get config.

. /etc/sysconfig/network

# Check that networking is up.

[ "${NETWORKING}" = "no" ] && exit 0

tomcat=/usr/local/tomcat

startup=$tomcat/bin/startup.sh

shutdown=$tomcat/bin/shutdown.sh

export JAVA_HOME=/usr/java/defautl

start(){

 echo -n $"Starting Tomcat service: "

 #daemon -c

 $startup

 RETVAL=$?

 echo

}

stop(){

 action $"Stopping Tomcat service: " $shutdown

 RETVAL=$?

 echo

}

# Status provided by http://www.spaceprogram.com/knowledge/2004/01/starting-tomcat-as-service-on-linux.html

status(){

  numproc=`ps -ef | grep catalina | grep -v "grep catalina" | wc -l`

  if [ $numproc -gt 0 ]; then

  echo "Tomcat is running..."

  else

  echo "Tomcat is stopped..."

  fi

}

restart(){

  stop

  start

}

# See how we were called.

case "$1" in

start)

 start

 ;;

stop)

 stop

 ;;

status)

  # This doesn't work

status tomcat

;;

restart)

restart

;;

*)

echo $"Usage: $0 {start|stop|status|restart}"

exit 1

esac

exit 0

Make this an executable
chmod +x /etc/init.d/tomcat
chkconfig --add tomcat
Here are the commands for the service tomcat
service tomcat restart
service tomcat start
service tomcat status
service tomcat stop
Add an entry to the firewall.

Make this installation accessible beyond the localhost.

/sbin/service iptables save
/sbin/service iptables stop
gedit /etc/sysconfig/iptables
Add the following execption. Port 8080 is used by Tomcat.
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT

Save the file, and restart the service

/sbin/service iptables start
Tested and Works (March 23, 2010, May 20, 2010)

Java JDK 1.6.18 and Java JDK 1.6.20
Tomcat 5.5.28
Red Hat Enterprise Linux (RHEL) 5.4, RHEL 5.5, CentOS 5.4, CentOS 5.5