首先准备安装包:
http://mirror.bjtu.edu.cn/apache/tomcat/tomcat-7/v7.0.35/bin/apache-tomcat-7.0.35.tar.gz
这里我把安装包放在/usr/soft/
apache-tomcat-7.0.29.tar.gz
jdk-6u33-linux-x64-rpm.bin
创建java目录,并把jdk-6u33-linux-x64-rpm.bin移动到/usr/java/目录下
mkdir /usr/java
[root@localhost java] #mv jdk-6u33-linux-x64-rpm.bin /usr/java
设置安装包执行权限
[root@localhost java] #chmod 777 jdk-6u33-linux-x64-rpm.bin
运行java安装包
[root@localhost java]#./ jdk-6u33-linux-x64-rpm.bin
Unpacking...
Checksumming...
Extracting...
UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu).
  inflating: jdk-6u34-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%]
 
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 Oracle products, services and training
* Access to early releases and documentation
 
Product and system data will be collected. If your configuration
supports a browser, the JDK Product Registration form 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@localhost java]# ls
default                                sun-javadb-common-10.6.2-1.1.i386.rpm
jdk1.6.0_34                            sun-javadb-core-10.6.2-1.1.i386.rpm
jdk-6u34-linux-amd64.rpm               sun-javadb-demo-10.6.2-1.1.i386.rpm
jdk-6u34-linux-x64-rpm.bin             sun-javadb-docs-10.6.2-1.1.i386.rpm
latest                                 sun-javadb-javadoc-10.6.2-1.1.i386.rpm
sun-javadb-client-10.6.2-1.1.i386.rpm执行java rpm安装包
[root@localhost java]#rpm -ivh jdk-6u33-linux-amd64.rpm
Preparing...                ########################################### [100%]
         package jdk-2000:1.6.0_34-fcs.x86_64 is already installed
使用qi参数可以查看jdk安装之后的信息,已经安装到/usr/java/下面
[root@localhost java]# rpm -qi jdk
Name        : jdk                          Relocations: /usr/java
Version     : 1.6.0_34                          Vendor: Oracle and/or its affiliates.
Release     : fcs                           Build Date: 20120719 星期四 212035
Install Date: 20120907 星期五 102350      Build Host: jdk-lin-amd64.sfbay.sun.com
Group       : Development/Tools             Source RPM: jdk-1.6.0_34-fcs.src.rpm
Size        : 127042575                        License: Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. Also under other license(s) as shown at the Description field.
Signature   : (none)
Packager    : Java Software <jre-comments@java.sun.com>
URL         : http://www.oracle.com/technetwork/java/javase/overview/index.html
Summary     : Java(TM) Platform Standard Edition Development Kit
Description :
The Java Platform Standard Edition Development Kit (JDK) includes both
the runtime environment (Java virtual machine, the Java platform classes
and supporting files) and development tools (compilers, debuggers,
tool libraries and other tools).
 
The JDK is a development environment for building applications, applets
and components that can be deployed with the Java Platform Standard
Edition Runtime Environment.
 
设置JAVA_HOME环境变量
vim /etc/profile
#JAVA_HOME SETTING
export JAVA_HOME=/usr/java/jdk1.6.0_33
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH
 
注:在profile最后添加环境变量时,由于centos6.2默认安装了OpenJDK所以把JAVA_HOME的位置在PATH置前。然后重启reboot或者init 6 java -version检查显示结果为:
[root@localhost ~]# java -version
java version "1.6.0_34"
Java(TM) SE Runtime Environment (build 1.6.0_34-b04)
Java HotSpot(TM) 64-Bit Server VM (build 20.9-b04, mixed mode)  则证明安装成功
 
cd  /usr/soft/
[root@localhost soft]# tar xf apache-tomcat-7.0.29.tar.gz
设置系统环境变量:
[root@localhost soft]# vim /etc/profile
export TOMCAT_HOME=/usr/soft/apache-tomcat-7.0.29
export CATALINA_HOME=/usr/soft/apache-tomcat-7.0.29
 
设置tomcat系统开机自动启动:
[root@localhost soft]# echo "/usr/soft/apache-tomcat-7.0.29/bin/startup.sh" >> /etc/rc.local或者直接编辑vim /etc/rc.local
添加/usr/soft/apache-tomcat-7.0.29/bin/startup.sh即可
 
测试tomcat配置正确:
http://10.200.10.11:8080

则此时tomcat安装成功!