linux上安装tomca和JDK

linux下安装tomca和JDK

1安装JDK

1.       查看是否已经安装过JDK,登录linux运行命令:java –version

如果显示:

java version "1.6.0_25"

Java(TM) SE Runtime Environment (build 1.6.0_25-b06)

Java HotSpot(TM) Server VM (build 20.0-b11, mixed mode)

说明已经安装了系统自带的JDK

2.       查看已安装JDK信息,运行命令:rpm -qa|grep java

显示:

java-1.4.2-gcj-compat-1.4.2.0-27jpp

gcc-java-3.4.6-3

3.       删除已安装JDK,运行命令:rpm –e --nodeps ******(代表已安装的jdkjdk相关类库)

删除原JDK

4.       安装JDK,上传jdk安装程序至服务器,在jdk所在目录运行命令:chmod +x jdk-6u23-linux-i586-rpm.bin (jdk文件名称),更改执行权限。继续运行命令:./jdk-6u23-linux-i586-rpm.bin

显示:

Unpacking...

Checksumming...

Extracting...

UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu).

  inflating: jdk-6u23-linux-i586.rpm 

  inflating: sun-javadb-common-10.5.3-0.2.i386.rpm 

  inflating: sun-javadb-core-10.5.3-0.2.i386.rpm 

  inflating: sun-javadb-client-10.5.3-0.2.i386.rpm 

  inflating: sun-javadb-demo-10.5.3-0.2.i386.rpm 

  inflating: sun-javadb-docs-10.5.3-0.2.i386.rpm 

  inflating: sun-javadb-javadoc-10.5.3-0.2.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.....

说明JDK已经安装成功。

5.       修改JDK运行目录,运行命令:vi /etc/profile

添加如下内容:

export JAVA_HOME=/root/jdk1.6.0_18(JDK所在目录)

export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

export PATH=$PATH:$JAVA_HOME/bin

export JRE_HOME=$JAVA_HOME/jre

6.       验证JDK,运行命令:java –version

显示:

java version "1.6.0_25"

Java(TM) SE Runtime Environment (build 1.6.0_25-b06)

Java HotSpot(TM) Server VM (build 20.0-b11, mixed mode)

说明JDK已经安装成功。

2安装Tomcat

1.       上传tomcat至服务器,运行命令:chmod +x apache-tomcat-6.0.29.tar.gz

2.       解压tomcat,运行命令:tar –zxvf apache-tomcat-6.0.29.tar.gz

3.       运行tomcat,运行命令:cd apache-tomcat-6.0.29/bin | ./startup.sh

4.       打开浏览器输入服务器tomcat地址验证tomcat是否启动成功。