Original link: http://www.cnblogs.com/xsi640/p/3757015.html
Another more detailed blog post: http://blog.csdn.net/zhngjan/article/details/25223423
Download the latest GZ installation package from the Tomcat website first
File name: apache-tomcat-8.0.8.tar.gz
Upload the file to the/usr/local directory
Perform decompression
Tar zxvf apache-tomcat-8.0.8.tar.gz
Name the directory apache-tomcat-8.0.8 tomcat
MV apache-tomcat-8.0.8 Tomcat
Running/usr/local/tomcat/bin/startup.sh will start Tomcat
To configure the auto-start script:
#!/bin/bash## Tomcat startup script forThe Tomcat server## chkconfig:345 the -# Description:start The Tomcat deamon## Source function library./etc/rc.d/init.d/Functionsprog=Tomcatjava_home=/usr/java/jdk1.6. 0_27export Java_homecatalana_home=/usr/local/Tomcatexport catalina_home Case " $" inchstart) echo"starting Tomcat ..."$CATALANA _home/bin/startup.sh;; Stop) Echo"stopping Tomcat ..."$CATALANA _home/bin/shutdown.sh;; Restart) echo"stopping Tomcat ..."$CATALANA _home/bin/shutdown.sh Sleep2Echo Echo"starting Tomcat ..."$CATALANA _home/bin/startup.sh;;*) echo"Usage: $prog {Start|stop|restart}" ;; Esacexit0
Name the file tomcat and put it in the/etc/init.d/directory
Modify permissions, you can run
chmod +x/etc/init.d/tomcat
Set up start-up service automatically
sudo chkconfig tomcat on
Start the service:
Service Tomcat Start
Stop service:
Service Tomcat Stop
Configure the firewall to open the corresponding port:
Vi/etc/sysconfig/iptables
-A input-m state--state new-m tcp-p TCP--dport 8080-j ACCEPT
Restarting the firewall
Service Iptables Restart
"Go" Install Tomcat on CentOS