系統環境:html
[root@ORACLE logs]# uname -a Linux ORACLE 2.6.18-308.el5 #1 SMP Fri Jan 27 17:17:51 EST 2012 x86_64 x86_64 x86_64 GNU/Linux [root@ORACLE logs]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 5.8 (Tikanga)
安裝包:java
jdk-7u45-linux-x64.gzlinux
apache-tomcat-6.0.43.tar.gzapache
安裝過程:bootstrap
首先安裝jdk環境,要看jdk安裝請查看上一篇jetty安裝 http://www.cnblogs.com/cheerong/p/4375894.htmltomcat
一、配置系統環境,修改~/.bash_profile文件,添加一下內容:bash
TOMCAT_HOME=/usr/local/tomcat6.0 CATALINA_HOME=/usr/local/tomcat6.0 CATALINA_BASE=/usr/local/tomcat6.0 JAVA_HOME=/usr/local/jdk1.7 JAVA_BIN=/usr/local/jdk1.7/bin PATH=$PATH:$JAVA_BIN:/usr/local/maven/bin:$HOME/bin CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export JAVA_HOME JAVA_BIN PATH CLASSPATH JETTY_HOME TOMCAT_HOME CATALINA_HOME CATALINA_BASE
運行 source ~/.bash_profile,使配置生效
二、解壓安裝包:maven
tar -xf apache-tomcat-6.0.43.tar.gz -C /usr/local/
ln -s apache-tomcat-6.0.43 tomcat6.0
三、啓動tomcattcp
[root@ORACLE bin]# ./catalina.sh start Using CATALINA_BASE: /usr/local/tomcat6.0 Using CATALINA_HOME: /usr/local/tomcat6.0 Using CATALINA_TMPDIR: /usr/local/tomcat6.0/temp Using JRE_HOME: /usr/local/jdk1.7 Using CLASSPATH: /usr/local/tomcat6.0/bin/bootstrap.jar [root@ORACLE bin]# ps aux|grep java root 3971 12.2 5.7 539088 59084 pts/0 Sl 16:44 0:04 /usr/local/jdk1.7/bin/java -Djava.util.logging.config.file=/usr/local/tomcat6.0/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/local/tomcat6.0/endorsed -classpath /usr/local/tomcat6.0/bin/bootstrap.jar -Dcatalina.base=/usr/local/tomcat6.0 -Dcatalina.home=/usr/local/tomcat6.0 -Djava.io.tmpdir=/usr/local/tomcat6.0/temp org.apache.catalina.startup.Bootstrap start root 4048 78.3 5.9 656604 60564 pts/0 Sl 16:44 0:04 /usr/local/jdk1.7/bin/java -Djava.util.logging.config.file=/usr/local/tomcat6.0/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/local/tomcat6.0/endorsed -classpath /usr/local/tomcat6.0/bin/bootstrap.jar -Dcatalina.base=/usr/local/tomcat6.0 -Dcatalina.home=/usr/local/tomcat6.0 -Djava.io.tmpdir=/usr/local/tomcat6.0/temp org.apache.catalina.startup.Bootstrap start root 4061 0.0 0.0 61176 724 pts/0 R+ 16:44 0:00 grep java [root@ORACLE bin]# netstat -tpln|grep 8080 [root@ORACLE bin]# netstat -tpln|grep 8088 tcp 0 0 :::8088 :::* LISTEN 3971/java
如上圖,查看tomcat進程,tomcat端口號默認爲8080,這裏是我更改成8088以後運行的。spa
修改tomcat端口號爲修改server.xml文件:
<Connector port="8088" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />