linux 安装tomcat

1:卸载掉自带的OpenJDK

2: 安装 JDK1.6

3:安装Tomcat

=================================================== 

1:卸载掉自带的OpenJDK

2: 安装 JDK1.6

 

 参考:

 http://www.cnblogs.com/sixiweb/archive/2012/11/25/2787684.html

 

原文:

 

查看目前系统的jdk: rpm -qa | grep jdk

得到的结果: 

[root@dc-01 java]#  rpm -qa | grep jdk

java-1.6.0-openjdk-1.6.0.0-1.45.1.11.1.el6.i686 

 

卸载之:

 [root@dc-01 java]# yum -y remove java-1.6.0-openjdk-1.6.0.0-1.45.1.11.1.el6.i686

 

 

等一段时间就Complete了。

下载Sun的JDK。我下载的是 

jdk-6u37-linux-i586-rpm.bin 

如果是64位系统的话,要下载:

 jdk-6u37-linux-x64-rpm.bin

之类的64位专用的包 

 

到/usr目录下创建java目录,将下载的文件放到/usr/java目录下 

先将这个文件变为可执行文件(chmod 777) :

[root@dc-01 java]# chmod 777 jdk-6u37-linux-i586-rpm.bin 

然后执行这个文件件进行安装:

[root@dc-01 java]# ./jdk-6u37-linux-i586-rpm.bin 
Unpacking...
Checksumming...
Extracting...
UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu).
  inflating: jdk-6u37-linux-i586.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 .

 

至此安装结束。

 

接下来配置JDK:

 vi /etc/profile打开profile文件,在profile文件的末尾加上:

 
JAVA_HOME=/usr/java/jdk1.6.0_37
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME
export PATH
export CLASSPATH 

 

 

 

保存并关闭profile文件,执行source /etc/profile命令让修改生效。

运行下java -version 看一下java版本 :

 [root@dc-01 java]# java -version

java version "1.6.0_37"
Java(TM) SE Runtime Environment (build 1.6.0_37-b06)
Java HotSpot(TM) Client VM (build 20.12-b01, mixed mode, sharing)
[root@dc-01 java]# 

 ================================================

 

 至此,整个安装过程完毕。

 

3:安装Tomcat

 下载apache-tomcat-7.0.33.tar.gz。解压缩:

 

 tar -xzvf apache-tomcat-7.0.33.tar.gz

将解压缩后的文件夹拷贝到/usr/local/tomcat:

cp -R apache-tomcat-7.0.33 /usr/local/tomcat

启动tomcat:sh startup.sh或者sh /usr/local/tomcat7/bin/startup.sh

此时可在浏览器查看http://localhost:8080,如果没有图形界面,则需要打开端口才可访问。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值