Install jdk with rpm under linux

1. Download the rpm installation package of jdk, here is an example of jdk-6u21-linux-i586-rpm.bin

Download address: http://www.oracle.com/technetwork/java/javase/downloads/index.html

 

2. Move jdk-6u21-linux-i586-rpm.bin to the appropriate installation directory, and do not install the software in the /home path, which will easily involve the access rights of different users, so the maintenance of the program is quite Adverse. This will move the installation package to the /opt directory

 

[c-sharp]  view plain copy
 
  1. mv jdk-6u21-linux-i586-rpm.bin /opt ; move the installation package to the /opt directory  
  2. cd / opt  

 

 

 

3. Give the installation package permission to run

 

[c-sharp]  view plain copy
 
  1. chmod 755 jdk-6u21-linux-i586-rpm.bin   

 

 

 

 

3. Install the rpm installation package

 

[c-sharp]  view plain copy
 
  1. [root@localhost opt]# ./jdk-6u21-linux-i586-rpm.bin ; run the installation package  
  2. Unpacking...  
  3. Checksumming...  
  4. Extracting...  
  5. UnZipSFX 5.50 of 17 February 2002, by Info-ZIP ([email protected]).  
  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.    
  48. Done.  

 

 

 

4. 设置环境变量

 

[c-sharp]  view plain copy
 
  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 ; save and exit  

 

 

 

 

 

 

 

 

 

Copyright statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326932011&siteId=291194637