Breaking News
Sunday, August 18, 2013

How to install Tomcat 7.0.42 on CentOS 6.4

1. Introduction Tomcat
Apache Tomcat is an open source software implementation of the Java Servlet and JavaServer Pages technologies. The Java Servlet and JavaServer Pages specifications are developed under the Java Community Process.
Apache Tomcat is developed in an open and participatory environment and released under the Apache License version 2. Apache Tomcat is intended to be a collaboration of the best-of-breed developers from around the world. We invite you to participate in this open development project. To learn more about getting involved, click here.
Apache Tomcat powers numerous large-scale, mission-critical web applications across a diverse range of industries and organizations. Some of these users and their stories are listed on the PoweredBy wiki page.
Apache Tomcat, Tomcat, Apache, the Apache feather, and the Apache Tomcat project logo are trademarks of the Apache Software Foundation 
 2. Install Tomcat 7.0.42
Step 1: Download Tomcat
Before install Tomcat read How to Install JDK/JRE 7u25 on Linux CentOS 6.4/Redhat. Download and Unpack Tomcat 7. Find the latest download link here for the Core Tar file
# cd /usr/share
# wget
# tar -xzf apache-tomcat-7.0.42.tar.gz
# cd /etc/init.d
# vi tomcat
In this new file copy the following:
# description: Tomcat Start Stop Restart
# processname: tomcat
# chkconfig: 234 20 80
export JAVA_HOME
export PATH

case $1 in
exit 0
Step 2: Save this and run the following command
# chmod 755 tomcat
# chkconfig --add tomcat
# chkconfig --level 234 tomcat on

Step 3: You can now start, stop and restart tomcat using:
#service tomcat stop
#service tomcat start
#service tomcat restart
Step 4: 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
Step 5: Run Tomcat


  1. In the step:

    # cd /etc/init.d
    # vi /tomcat

    Remember to remove the / from "vi /tomcat". It should be just

    # cd /etc/init.d
    # vi tomcat

  2. Thanks for the comments Ryan X :) (f)


Toggle Footer