Installing and configuring tomcat-7 in CentOS 6.3

Time:2021-9-30

Installation instructions
Installation environment: centos-6.3
Installation method: source code installation
Software: apache-tomcat-7.0.29.tar.gz
Download address: http://tomcat.apache.org/download-70.cgi

Installation premise

The system must have JDK6 + installed and configured. Please refer to: installing and configuring jdk-7 in centos-6.3.

Install Tomcat
Upload the apache-tomcat-7.0.29.tar.gz file to / usr / local, and do the following:

Copy code

The code is as follows:

[[email protected] local]# cd /usr/local
[ [email protected] Local]# tar – zxv – F apache-tomcat-7.0.29. Tar. Gz / / unzip the package
[ [email protected] Local]# RM – RF apache-tomcat-7.0.29. Tar. Gz / / delete the compressed package
[[email protected] local]# mv apache-tomcat-7.0.29 tomcat

Start Tomcat

Do the following:

Copy code

The code is as follows:

[ [email protected] ~]#/ usr / local / Tomcat / bin / startup. SH / / start Tomcat
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/java/jdk1.7.0/jre
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar

The above message indicates that it has been started successfully.

Firewall open port 8080

Add port 8080 to the firewall configuration, and perform the following operations:
[[email protected] ~]# vi + /etc/sysconfig/iptables
#Add the following code
-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 8080 -j ACCEPT

service iptables restart
[[email protected] java]# service iptables restart
Verify Tomcat installation and operation

Check whether Tomcat works normally through the following address:
http://192.168.15.231:8080/
See the Tomcat system interface, indicating that the installation is successful!

Stop Tomcat
[ [email protected] ~]#   / usr/local/tomcat/bin/shutdown.sh    // Stop Tomcat