安装Tomcat 6.0.29压缩包
1、安装Tomcat 解压缩apache-tomcat-6.0.29.zip到任意一个有权限的目录即可,如/home/its/apache-tomcat-6.0.29。 2、下载安装JDK(jdk1.6.0_24-linux-i586.bin ): [root@mysqlvm2 ~]# ./jdk-6u45-linux-x64-rpm.bin -bash: ./jdk-6u45-linux-x64-rpm.bin: ?..涓.?
3需要修改可执行权限 chmod u x jdk-6u45-linux-x64-rpm.bin
4 然后执行安装 [root@mysqlvm2 ~]# ./jdk-6u45-linux-x64-rpm.bin Unpacking... Checksumming... Extracting... UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu). inflating: jdk-6u45-linux-amd64.rpm inflating: sun-javadb-common-10.6.2-1.1.i386.rpm inflating: sun-javadb-core-10.6.2-1.1.i386.rpm inflating: sun-javadb-client-10.6.2-1.1.i386.rpm inflating: sun-javadb-demo-10.6.2-1.1.i386.rpm inflating: sun-javadb-docs-10.6.2-1.1.i386.rpm inflating: sun-javadb-javadoc-10.6.2-1.1.i386.rpm Preparing... ########################################### [100%] 1:jdk ########################################### [100%] Unpacking JAR files... rt.jar... jsse.jar... charsets.jar... tools.jar... localedata.jar... plugin.jar... javaws.jar... deploy.jar... Installing JavaDB Preparing... ########################################### [100%] 1:sun-javadb-common ########################################### [ 17%] 2:sun-javadb-core ########################################### [ 33%] 3:sun-javadb-client ########################################### [ 50%] 4:sun-javadb-demo ########################################### [ 67%] 5:sun-javadb-docs ########################################### [ 83%] 6:sun-javadb-javadoc ########################################### [100%] Done. [root@mysqlvm2 ~]#
设置环境变量:vi ~/.bash_profile如下: JAVA_HOME=/usr/java/jdk1.6.0_45/ #必填 PATH=$PATH:$HOME/bin PATH=$JAVA_HOME/bin:$PATH #必填 CLASS_PATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export JAVA_HOME #必填 export CLASS_PATH export TOMCAT_HOME=/usr/tomcat-6.0.37 export CATALINA_HOME=/usr/tomcat-6.0.37 export PATH 注: #部分为必须,其他设置非必须。 3、启动Tomcat # cd /usr/tomcat-6.0.37/bin # ./startup.sh [root@mysqlvm2 tomcat-6.0.37]# cd /usr/tomcat-6.0.37/bin [root@mysqlvm2 bin]# ./startup.sh Using CATALINA_BASE: /usr/tomcat-6.0.37 Using CATALINA_HOME: /usr/tomcat-6.0.37 Using CATALINA_TMPDIR: /usr/tomcat-6.0.37/temp Using JRE_HOME: /usr Using CLASSPATH: /usr/tomcat-6.0.37/bin/bootstrap.jar [root@mysqlvm2 bin]# ps -eaf|grep tomcat root 9092 1 47 14:36 pts/1 00:00:04 /usr/bin/java -Djava.util.logging.config.file=/usr/tomcat-6.0.37/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Xms1024m -Xmx1024m -Xss1024K -XX:PermSize=256m -XX:MaxPermSize=512m -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=1090 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.endorsed.dirs=/usr/tomcat-6.0.37/endorsed -classpath /usr/tomcat-6.0.37/bin/bootstrap.jar -Dcatalina.base=/usr/tomcat-6.0.37 -Dcatalina.home=/usr/tomcat-6.0.37 -Djava.io.tmpdir=/usr/tomcat-6.0.37/temp org.apache.catalina.startup.Bootstrap start root 9114 8010 0 14:36 pts/1 00:00:00 grep tomcat
如果报错如下: The BASEDIR environment variable is not defined correctly This environment variable is needed to run this program 解决办法: 添加/usr/tomcat-6.0.37/bin下所有.sh文件可执行权限如下: $ cd /usr/tomcat-6.0.37/bin $ chmod x *.sh 重新启动Tomcat即可。