Installation Instructions installation environment: CentOS7 installation method: Source code installation software: apache-tomcat-8.0.30.tar.gz: http://tomcat.apache.org/download-80.cgiinstallation before the system has been installed with jdk6133. (And configure environment variables) install tomcat to install the ap
Installation environment: CentOS7
Installation method: Source code installation
Software: apache-tomcat-8.0.30.tar.gz
: Http://tomcat.apache.org/download-80.cgi
Prerequisites
You must have installed and configured JDK 6 +. (And configure environment variables)
Install tomcat
Move the apache-tomcat-8.0.30.tar.gz file to/usr/local and perform the following operations:
[Root @ admin local] # cd/usr/local [root @ admin local] # tar-zxv-f apache-tomcat-8.0.30..tar.gz // Unzip the compressed package [root @ admin local] # rm-rf apache-tomcat-8.0.30..tar.gz // delete the compressed package [root @ admin local] # mv apache-tomcat-8.0.30. tomcat
Start Tomcat
Perform the following operations:
[Root @ admin ~] #/Usr/local/tomcat/bin/startup. sh // start tomcatUsing CATALINA_BASE:/usr/local/tomcatUsing CATALINA_HOME:/usr/local/tomcatUsing CATALINA_TMPDIR:/usr/local/tomcat/tempUsing JRE_HOME: /usr/java/jdk1.7.0/jreUsing CLASSPATH:/usr/local/tomcat/bin/bootstrap. jar:/usr/local/tomcat/bin/tomcat-juli.jar
The preceding printed information indicates that the instance has been started successfully.
Configure as Linux Service
Next, configure Tomcat-8 as a Linux Service.
Configure Tomcat-8 [root @ localhost ~] Cd/usr/local/tomcat/bin [root @ localhost bin] cp catalina. sh/etc/init. d [root @ localhost tomcat7] cd/etc/init. d [root @ localhost init. d] mv catalina. sh tomcat [root @ localhost init. d] gedit tomcat #! /Bin/bash input # chkconfig: 2345 10 90 # description: Tomcat service // At # OS specific support ................ enter CATALINA_HOME =/usr/local // tomcat JAVA_HOME =/usr/java/jdk1.6.0 _ 38 // to save and exit the file [root @ localhost init. d] chmod + x tomcat [root @ localhost init. d] cd/[root @ localhost/] gedit/etc/profile // enter # CATALINA_HOMECATALINA_HOME =/usr/local/tomcatexport CATALINA_HOME // save and exit the file [root @ localhost/] source/etc/profil E [3] Add tomcat to service list [root @ localhost/] chkconfig -- add tomcat [4] Check service list [root @ localhost/] chkconfig -- list tomcattomcat 0: close 1: disable 2: Enable 3: Enable 4: enable 5: Enable 6: disable [5] Test tomcat service [root @ localhost/] service tomcat ------------------ Using CATALINA_BASE:/tomcat8Using CATALINA_HOME: /tomcat8Using CATALINA_TMPDIR:/tomcat8/tempUsing JRE_HOME:/usr/java/jdk1.7.0 _ 25 Using CLASSPATH :/ Tomcat/bin/bootstrap. jar:/tomcat/bin/tomcat-juli.jar Usage: catalina. sh (commands ...)..... -------------------- [6] Start tomcat service [root @ localhost/] service tomcat start [7] OK!
Open Firewall port 8080
Add port 8080 to the firewall configuration and perform the following operations:
[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 firewall
[root@admin java]# service iptables restart
Verify Tomcat installation and running
Check whether tomcat is running normally at the following address: http: // 127.0.0.1: 8080/. check the tomcat System Interface. Congratulations! the installation is successful!
Stop Tomcat
[Root @ admin ~] #/Usr/local/tomcat/bin/shutdown. sh // stop tomcat