1. Download The tar.gz package of Tomcat (Tomcat depends on the Java environment. If JDK is not installed, install JDK first)
curl -O http://mirrors.cnnic.cn/apache/tomcat/tomcat-6/v6.0.41/bin/apache-tomcat-6.0.41.tar.gz
2.decompress tar.gz
mkdir /usr/local/servertar -zxvf apache-tomcat-6.0.41.tar.gz -C /usr/local/server
3. Test the Tomcat running environment
apache-tomcat-6.0.41/bin/startup.sh
If the following characters are displayed, the test is successful.
Using CATALINA_BASE: /usr/local/server/apache-tomcat-6.0.41Using CATALINA_HOME: /usr/local/server/apache-tomcat-6.0.41Using CATALINA_TMPDIR: /usr/local/server/apache-tomcat-6.0.41/tempUsing JRE_HOME: /usrUsing CLASSPATH: /usr/local/server/apache-tomcat-6.0.41/bin/bootstrap.jar
End Tomcat Process
ps aux | grep tomcatroot 2933 1.3 6.1 1068472 62480 pts/0 Sl 20:20 0:02 /usr/bin/java -Djava.util.logging.config.file=/usr/local/server/apache-tomcat-6.0.41/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/local/server/apache-tomcat-6.0.41/endorsed -classpath /usr/local/server/apache-tomcat-6.0.41/bin/bootstrap.jar -Dcatalina.base=/usr/local/server/apache-tomcat-6.0.41 -Dcatalina.home=/usr/local/server/apache-tomcat-6.0.41 -Djava.io.tmpdir=/usr/local/server/apache-tomcat-6.0.41/temp org.apache.catalina.startup.Bootstrap startroot 2960 0.0 0.0 103240 848 pts/0 S+ 20:23 0:00 grep tomcatkill -9 2933
4. install Tomcat as a system service
cp catalina.sh /etc/init.d/tomcat
Edit Tomcat File
vim /etc/init.d/tomcat
Add at the end of the comment
# OS specific support. $ VaR _ must _ be set to either true or false. # Add the following content: # chkconfig # parameter 1: system startup level (which indicates that the service is automatically started at 2, 3, and 5) # parameter 2: Service startup sequence # parameter 3: service stop sequence # description service description # chkconfig: 2345 10 90 # Description: Tomcat Service
Add more java and tomcat paths
CATALINA_HOME=/usr/local/server/apache-tomcat-6.0.41JAVA_HOME=/usr/java/jdk1.6.0_45
After editing, WQ exits and adds a service.
chkconfig --add tomcat
Check whether the service is successfully added.
chkconfig --list | grep tomcat
If the following characters are displayed, the script is successfully added (the running level in Linux 7 is displayed. The subscript starts from 0, and is set to start at 2, 3, and 4, 5)
tomcat 0:off1:off2:on3:on4:on5:on6:off
5. Restart the test
reboot
An error is reported at this time./usr/local/Server/Apache-Tomcat-6.0.41/logs has insufficient permissions.
chmod 777 /usr/local/server/apache-tomcat-6.0.41/logs
Restart...
ps aux | grep tomcat
service tomcat stopservice tomcat start
End of this Article
This article from the "Copper Mirror" blog, please be sure to keep this source http://tangoo.blog.51cto.com/9130178/1532965