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
[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
[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
[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完成。
本文来自:韦少乾博客(mven.cn)
详细出处:http://mven.cn/post/42.html