CentOS6.5 install Tomcat7.0.29
I. Description
Install and configure Tomcat 7.0.29 using source code on CentOS6.5.
Ii. Installation Steps
1. Check whether jdk is installed. By default, jdk is installed on CentOS6.x. Run the following command to check whether jdk has been installed on the system:
[Tong @ tong tongSoftware] $ rpm-qa | grep jdk
Java-1.7.0-openjdk-1.7.0.65-2.5.1.2.el6_5.x86_64
Java-1.6.0-openjdk-1.6.0.0-11.1.13.4.el6.x86_64
It indicates that jdk has been installed. If jdk is not installed in the system, go to the oracle official website to download the jdk source code installation package for installation.
2. Use wget to download, decompress, and rename
[tong@tong tongSoftware]$ sudo wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-7/v7.0.59/bin/apache-tomcat-7.0.59.tar.gz[tong@tong tongSoftware]$ sudo tar xzvf apache-tomcat-7.0.59.tar.gz[tong@tong tongSoftware]$ sudo mv apache-tomcat-7.0.59 tomcat7
3. configure the firewall, enable port 8080, and add the lines marked in red below
[tong@tong bin]$ sudo vi /etc/sysconfig/iptables-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT# Firewall configuration written by system-config-firewall# Manual customization of this file is not recommended.*filter:INPUT ACCEPT [0:0]:FORWARD ACCEPT [0:0]:OUTPUT ACCEPT [0:0]-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT-A INPUT -p icmp -j ACCEPT-A INPUT -i lo -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT-A INPUT -j REJECT --reject-with icmp-host-prohibited-A FORWARD -j REJECT --reject-with icmp-host-prohibitedCOMMIT
4. Restart the Firewall
[Tong @ tong bin] $ service iptables restart
5. start Tomcat 7 and enter the bin directory in the Tomcat installation directory and execute the following command:
[tong@tong bin]$ cd /usr/local/tongSoftware/tomcat7/bin/[tong@tong bin]$ sudo ./startup.shUsing CATALINA_BASE: /usr/local/tongSoftware/tomcat7Using CATALINA_HOME: /usr/local/tongSoftware/tomcat7Using CATALINA_TMPDIR: /usr/local/tongSoftware/tomcat7/tempUsing JRE_HOME: /usrUsing CLASSPATH: /usr/local/tongSoftware/tomcat7/bin/bootstrap.jar:/usr/local/tongSoftware/tomcat7/bin/tomcat-juli.jarTomcat started.
6. Test Tomcat
Enter: http: // ip address: 8080 in the browser. For example, my website is http: // 192.168.200.5: 8080. The following page is displayed:
7. Run the case program that comes with Tomcat and enter http: // 192.168.200.5: 8080/examples/jsp/in the address bar/