ITeye博客

linux下用rpm 安装jdk

zac110 · 2015-09-05 16:55 · linux · 行业应用 · Markdown

1.下载jdk的rpm安装包,这里以jdk-6u21-linux-i586-rpm.bin为例进行说明

下载地址:http://www.oracle.com/technetwork/java/javase/downloads/index.html

 

2. 将jdk-6u21-linux-i586-rpm.bin 移动到合适的安装目录上,安装软件不要在/home路径下,这样很容易涉及到不同用户的访问权限,这样对程序的维护,是相当不利的。这里将把安装包移动到/opt目录

 

[c-sharp] view plaincopy

 

  1. mv jdk-6u21-linux-i586-rpm.bin /opt   ;把安装包移动到/opt目录
  2. cd /opt

 

 

 

3. 给安装包赋予运行权限

 

[c-sharp] view plaincopy

 

  1. chmod 755 jdk-6u21-linux-i586-rpm.bin

 

 

 

 

3. 安装该rpm安装包

 

[c-sharp] view plaincopy

 

  1. [root@localhost opt]# ./jdk-6u21-linux-i586-rpm.bin            ;运行安装包
  2. Unpacking...
  3. Checksumming...
  4. Extracting...
  5. UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu).
  6. inflating: jdk-6u21-linux-i586.rpm
  7. inflating: sun-javadb-common-10.5.3-0.2.i386.rpm
  8. inflating: sun-javadb-core-10.5.3-0.2.i386.rpm
  9. inflating: sun-javadb-client-10.5.3-0.2.i386.rpm
  10. inflating: sun-javadb-demo-10.5.3-0.2.i386.rpm
  11. inflating: sun-javadb-docs-10.5.3-0.2.i386.rpm
  12. inflating: sun-javadb-javadoc-10.5.3-0.2.i386.rpm
  13. Preparing...                ########################################### [100%]
  14. 1:jdk                    ########################################### [100%]
  15. Unpacking JAR files...
  16. rt.jar...
  17. jsse.jar...
  18. charsets.jar...
  19. tools.jar...
  20. localedata.jar...
  21. plugin.jar...
  22. javaws.jar...
  23. deploy.jar...
  24. Installing JavaDB
  25. Preparing...                ########################################### [100%]
  26. 1:sun-javadb-common      ########################################### [ 17%]
  27. 2:sun-javadb-core        ########################################### [ 33%]
  28. 3:sun-javadb-client      ########################################### [ 50%]
  29. 4:sun-javadb-demo        ########################################### [ 67%]
  30. 5:sun-javadb-docs        ########################################### [ 83%]
  31. 6:sun-javadb-javadoc     ########################################### [100%]
  32. Java(TM) SE Development Kit 6 successfully installed.
  33. Product Registration is FREE and includes many benefits:
  34. * Notification of new versions, patches, and updates
  35. * Special offers on Sun products, services and training
  36. * Access to early releases and documentation
  37. Product and system data will be collected. If your configuration
  38. supports a browser, the Sun Product Registration form for
  39. the JDK will be presented. If you do not register, none of
  40. this information will be saved. You may also register your
  41. JDK later by opening the register.html file (located in
  42. the JDK installation directory) in a browser.
  43. For more information on what data Registration collects and
  44. how it is managed and used, see:
  45. http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html
  46. Press Enter to continue.....                                   ;按回车键继续
  47. Done.

 

 

 

4. 设置环境变量

 

[c-sharp] view plaincopy

 

  1. [root@localhost opt]# vi /etc/profile                          ;编辑系统配置文件
  2. ==================================================================================
  3. JAVA_HOME=/usr/java/jdk1.6.0_24/                               ;增加以下几行
  4. CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar     ;主要是配置路径
  5. PATH=$JAVA_HOME/bin:$PATH                                      ;
  6. export JAVA_HOME,PATH,CLASSPATH                                ;
  7. :wq                                                            ;保存退出

 

 

 

 

 

 

 

 

 

版权声明:本文为博主原创文章,未经博主允许不得转载。

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。