CentOS7.0 installation and configuration of Tomcat 7
- 2020-05-17 07:28:41
- OfStack
Installation instructions
Installation environment: CentOS-7.0.1406
Installation method: source installation
Software: apache tomcat - 7.0.29. tar. gz
Download address: http: / / tomcat apache. org/download - 70. cgi
Install the prerequisite
The system must be installed and configured with JDK6+. For installation, please refer to: install and configure 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:
The code is as follows:
[root@admin local]# cd /usr/local
[root@admin local]# wget http://apache.fayea.com/apache-mirror/tomcat/tomcat-7/v7.0.57/bin/apache-tomcat-7.0.57.tar.gz
[root@admin local]# tar -zxv -f apache-tomcat-7.0.29.tar.gz // Extract the compressed package
[root@admin local]# rm -rf apache-tomcat-7.0.29.tar.gz // Delete package
[root@admin local]# mv apache-tomcat-7.0.29 tomcat
Start the Tomcat
Do the following:
The code is as follows:
[root@admin ~]# /usr/local/tomcat/bin/startup.sh // Start the 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 information appears to indicate that the startup was successful.
The firewall opens port 8080
To add port 8080 to the firewall configuration, do the following:
[root@admin ~]# 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
Restart the firewall
[root@admin java]# service iptables restart
Verify that Tomcat is installed and running
Check if tomcat is running properly at the following address:
http://192.168.15.231:8080/
See tomcat system interface, it means the installation is successful!
Stop Tomcat
[root@admin ~]# /usr/local/tomcat/bin/shutdown.sh // stop tomcat