标签:tomact安装
#centos安装jak和tomcat环境 [root@server1 tomcat]# ls apache-tomcat-8.0.21.tar.gz jdk-8u40-linux-x64.tar.gz [root@server1 tomcat]# tar zxvf jdk-8u40-linux-x64.tar.gz [root@server1 tomcat]# mkdir /usr/java [root@server1 tomcat]# tar zxvf jdk-8u40-linux-x64.tar.gz -C /usr/java/ [root@server1 tomcat]# vim /etc/profile export JAVA_HOME=/usr/java/jdk1.8.0_40 export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export PATH=$PATH:$JAVA_HOME/bin [root@server1 tomcat]# tar zxvf apache-tomcat-8.0.21.tar.gz [root@server1 tomcat]# mv apache-tomcat-8.0.21 /usr/local/tomcat [root@server1 tomcat]# vim /usr/local/tomcat/conf/server.xml <Connector port="80" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> [root@server1 conf]# /usr/local/tomcat/apache-tomcat-8.0.21/bin/startup.sh Using CATALINA_BASE: /usr/local/tomcat/apache-tomcat-8.0.21 Using CATALINA_HOME: /usr/local/tomcat/apache-tomcat-8.0.21 Using CATALINA_TMPDIR: /usr/local/tomcat/apache-tomcat-8.0.21/temp Using JRE_HOME: /usr/java/jdk1.8.0_40 Using CLASSPATH: /usr/local/tomcat/apache-tomcat-8.0.21/bin/bootstrap.jar:/usr/local/tomcat/apache-tomcat-8.0.21/bin/tomc at-juli.jarTomcat started. [root@server1 tomcat]# netstat -tulnp | grep :80 tcp 0 0 ::ffff:127.0.0.1:8005 :::* LISTEN 1497/java tcp 0 0 :::8009 :::* LISTEN 1497/java tcp 0 0 :::80 :::* LISTEN 1497/java #浏览器测试效果http://TomcatServerIP #tomcat启动脚本 [root@server1 tomcat]# vi /etc/rc.d/init.d/tomcat #!/bin/sh #chkconfig: 2345 10 90 #description: Start and Stop the Tomcat JAVA_HOME=/usr/java/jdk1.8.0_40 TOMCAT_HOME=/usr/local/tomcat start_tomcat=$TOMCAT_HOME/bin/startup.sh stop_tomcat=$TOMCAT_HOME/bin/shutdown.sh start() { echo -n "Starting tomcat: " ${start_tomcat} echo "tomcat start ok" } stop() { echo -n "Shutdown tomcat" ${stop_tomcat} echo "tomcat stop ok" } case "$1" in start) start ;; stop) stop ;; restart) stop sleep 10 start ;; *) echo "Usage: $0 {start|stop|restart}" esac exit 0 [root@server1 tomcat]# chmod a+x /etc/rc.d/init.d/tomcat [root@server1 tomcat]# /etc/init.d/tomcat restart
本文出自 “吴善强” 博客,请务必保留此出处http://shanqiangwu.blog.51cto.com/8067564/1654634
标签:tomact安装
原文地址:http://shanqiangwu.blog.51cto.com/8067564/1654634