系统环境:
[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)
安装包:
jdk-7u45-linux-x64.gz
apache-tomcat-6.0.43.tar.gz
安装过程:
首先安装jdk环境,要看jdk安装请查看上一篇jetty安装 http://www.cnblogs.com/cheerong/p/4375894.html
1、配置系统环境,修改~/.bash_profile文件,添加一下内容:
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,使配置生效
2、解压安装包:
tar -xf apache-tomcat-6.0.43.tar.gz -C /usr/local/
ln -s apache-tomcat-6.0.43 tomcat6.0
3、启动tomcat
[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之后运行的。
修改tomcat端口号为修改server.xml文件:
<Connector port="8088" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />