---
title: "CentOS5.4安装Tomcat6.0.18全程文字记录[原创]"
author: "eryin"
date: "2010-04-08T22:54:10Z"
tags: []
categories: ["操作系统"]
slug: "centos5-4-tomcat6-0-18"
draft: false
lastmod: "2010-04-09T10:32:41Z"
id: 638476
url: "https://eryin.iteye.com/blog/638476"
---

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完成。

本文来自：韦少乾博客(mven.cn)  
详细出处：[http://mven.cn/post/42.html](http://mven.cn/post/42.html)