Install Tomcat 7 on Fedora/CentOS

Install Java Development Kit

Find and copy download link from here: http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u25-download-346242.html

wget http://download.oracle.com/otn-pub/java/jdk/6u25-b06/jdk-6u25-linux-x64.bin
mv jdk-6u25-linux-x64.bin* /opt/jdk-6u25-linux-x64.bin
mkdir /usr/java
cd /usr/java
sh /opt/jdk-6u25-linux-x64.bin  

Set JAVA Home

JAVA_HOME=/usr/java/jdk1.6.0_25
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH 
export PATH
vi /etc/profile.d/java.sh

Add to file

JAVA_HOME=/usr/java/jdk1.6.0_25
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH

Save and exit using :x

chmod +x /etc/profile.d/java.sh
echo $JAVA_HOME

Should display /usr/java/jdk1.6.0_25

Download and Unpack Tomcat 7

Find the latest download link here for the Core Tar file http://tomcat.apache.org/download-70.cgi

cd /root
wget http://mirror.lividpenguin.com/pub/apache/tomcat/tomcat-7/v7.0.12/bin/apache-tomcat-7.0.12.tar.gz
mv apache-tomcat-7.0.12.tar.gz /usr/share/apache-tomcat-7.0.12.tar.gz
cd /usr/share  
tar -xzf apache-tomcat-7.0.12.tar.gz
cd /etc/init.d
vi tomcat

In this new file copy the following:

#!/bin/bash
# description: Tomcat Start Stop Restart
# processname: tomcat
# chkconfig: 234 20 80
JAVA_HOME=/usr/java/jdk1.6.0_25
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
CATALINA_HOME=/usr/share/apache-tomcat-7.0.12


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

Save this and run the following command

chmod 755 tomcat
chkconfig --add tomcat
chkconfig --level 234 tomcat on 

You can now start, stop and restart tomcat using:

service tomcat stop
service tomcat start
service tomcat restart

Allowing Port 80 through firewall and redirecting 8080 to port 80

/sbin/iptables -I INPUT 1 -p tcp --dport 8080 -j ACCEPT
/sbin/iptables -I INPUT 1 -p tcp --dport 80 -j ACCEPT
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080    
iptables -t nat -A PREROUTING -p udp -m udp --dport 80 -j REDIRECT --to-ports 8080
/sbin/service iptables save
service iptables restart

Add user to GUI

vi /usr/share/apache-tomcat-7.0.12/conf/tomcat-users.xml