Last login: Thu Dec 10 19:04:29 2009 from 192.168.1.81
[root@CentOS ~]# cd /opt/soft/Tomcat/
[root@CentOS Tomcat]# ls -l
total 85972
-rw-r--r-- 1 root root  6142197 Apr  6  2009 apache-tomcat-6.0.18.tar.gz
-rw-r--r-- 1 root root 81792634 Nov  9 16:38 jdk-6u17-linux-i586.bin
#为了能够安装JDK,需要给予JDK的安装文件运行权限
[root@CentOS Tomcat]# chmod 777 jdk-6u17-linux-i586.bin
[root@CentOS Tomcat]# ls -l
total 85972
-rw-r--r-- 1 root root  6142197 Apr  6  2009 apache-tomcat-6.0.18.tar.gz
-rwxrwxrwx 1 root root 81792634 Nov  9 16:38 jdk-6u17-linux-i586.bin
#下面安装JDK
[root@CentOS Tomcat]# ./jdk-6u17-linux-i586.bin
Sun Microsystems, Inc. Binary Code License Agreement
for the JAVA SE DEVELOPMENT KIT (JDK), VERSION 6
……中间的部分省略……
Do you agree to the above license terms? [yes or no]
yes
Unpacking...
Checksumming...
Extracting...
UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu).
……中间的部分省略……
Java(TM) SE Development Kit 6 successfully installed.
Product Registration is FREE and includes many benefits:
* Notification of new versions, patches, and updates
* Special offers on Sun products, services and training
* Access to early releases and documentation
Product and system data will be collected. If your configuration
supports a browser, the Sun Product Registration form for
the JDK will be presented. If you do not register, none of
this information will be saved. You may also register your
JDK later by opening the register.html file (located in
the JDK installation directory) in a browser.
For more information on what data Registration collects and
how it is managed and used, see:
http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html
Press Enter to continue.....

Done.
[root@CentOS Tomcat]# ls
apache-tomcat-6.0.18.tar.gz  jdk1.6.0_17  jdk-6u17-linux-i586.bin
#将JDK移动到/usr/local/java目录
[root@CentOS Tomcat]# mv jdk1.6.0_17 /usr/local/java
[root@CentOS Tomcat]# ls
apache-tomcat-6.0.18.tar.gz  jdk-6u17-linux-i586.bin
[root@CentOS Tomcat]# ls -l
total 85972
-rw-r--r-- 1 root root  6142197 Apr  6  2009 apache-tomcat-6.0.18.tar.gz
-rwxrwxrwx 1 root root 81792634 Nov  9 16:38 jdk-6u17-linux-i586.bin
#至此,JDK安装完成,下面安装Tomcat。
[root@CentOS Tomcat]# tar -zxvf apache-tomcat-6.0.18.tar.gz
apache-tomcat-6.0.18/bin/catalina.sh
apache-tomcat-6.0.18/bin/digest.sh
apache-tomcat-6.0.18/bin/setclasspath.sh
……中间的部分省略……
apache-tomcat-6.0.18/webapps/manager/sessionsList.jsp
apache-tomcat-6.0.18/webapps/manager/status.xsd
apache-tomcat-6.0.18/webapps/manager/xform.xsl
[root@CentOS Tomcat]# ls
apache-tomcat-6.0.18  apache-tomcat-6.0.18.tar.gz  jdk-6u17-linux-i586.bin
#将TOMCAT移动到/usr/local/tomcat目录下。
[root@CentOS Tomcat]# mv apache-tomcat-6.0.18 /usr/local/tomcat
#编辑/etc/profile文件,增加TOMCAT的环境变量。
[root@CentOS local]# vi /etc/profile
# /etc/profile
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc
……中间的部分省略……
unset pathmunge
export JAVA_HOME=/usr/local/java
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOMR/bin
export TOMCAT_HOME=/usr/local/tomcat
export CATALINA_HOME=/usr/local/tomcat
export CLASSPATH=$CLASSPATH:$CATALINA_HOME/common/lib
"/etc/profile" 65L, 1317C written
[root@CentOS usr]# cd /usr/local/tomcat/bin
[root@CentOS bin]# ls
bootstrap.jar  catalina-tasks.xml  digest.bat   service.bat       shutdown.bat  startup.sh    tomcat-juli.jar       tool-wrapper.sh
catalina.bat   commons-daemon.jar  digest.sh    setclasspath.bat  shutdown.sh   tomcat6.exe   tomcat-native.tar.gz  version.bat
catalina.sh    cpappend.bat        jsvc.tar.gz  setclasspath.sh   startup.bat   tomcat6w.exe  tool-wrapper.bat      version.sh
[root@CentOS bin]# ./startup.sh
Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
At least one of these environment variable is needed to run this program
#设置的环境变量没有生效,需要重新登陆才可以。
[root@CentOS bin]# exit
logout
Last login: Fri Dec 11 09:43:57 2009 from 192.168.1.81
[root@CentOS ~]# cd /usr/local/tomcat/bin
[root@CentOS bin]# ls
bootstrap.jar  catalina-tasks.xml  digest.bat   service.bat       shutdown.bat  startup.sh    tomcat-juli.jar       tool-wrapper.sh
catalina.bat   commons-daemon.jar  digest.sh    setclasspath.bat  shutdown.sh   tomcat6.exe   tomcat-native.tar.gz  version.bat
catalina.sh    cpappend.bat        jsvc.tar.gz  setclasspath.sh   startup.bat   tomcat6w.exe  tool-wrapper.bat      version.sh
[root@CentOS bin]# ./startup.sh
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:       /usr/local/java
#好了,CentOS 5.4下安装JDK 6 Update 17和Tomcat 6.0.18完成。