centos6.2安装tomcat

首先准备安装包:
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 ([email protected]).
  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: 2012 07 19 星期四 21 20 35
Install Date: 2012 09 07 星期五 10 23 50       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 <[email protected]>
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 安装成功!


你可能感兴趣的:(安装,包)