http://blog./uid-15463753-id-4252690.html 1.查找java相關(guān)得列表 [qyf@localhost ~]$ yum -y list java* 執(zhí)行結(jié)果 [qyf@localhost ~]$ yum -y list java* Loaded plugins: fastestmirror base | 1.1 kB 00:00 base/primary | 995 kB 00:00 base 2789/2789 extras | 2.1 kB 00:00 extras/primary_db | 164 kB 00:20 updates | 1.9 kB 00:00 updates/primary_db | 422 kB 00:01 Available Packages java-1.4.2-gcj-compat.i386 1.4.2.0-40jpp.115 base java-1.4.2-gcj-compat-devel.i386 1.4.2.0-40jpp.115 base java-1.4.2-gcj-compat-javadoc.i386 1.4.2.0-40jpp.115 base java-1.4.2-gcj-compat-src.i386 1.4.2.0-40jpp.115 base java-1.6.0-openjdk.i386 1:1.6.0.0-5.1.13.3.el5_10 updates java-1.6.0-openjdk-demo.i386 1:1.6.0.0-5.1.13.3.el5_10 updates java-1.6.0-openjdk-devel.i386 1:1.6.0.0-5.1.13.3.el5_10 updates java-1.6.0-openjdk-javadoc.i386 1:1.6.0.0-5.1.13.3.el5_10 updates java-1.6.0-openjdk-src.i386 1:1.6.0.0-5.1.13.3.el5_10 updates java-1.7.0-openjdk.i386 1:1.7.0.55-2.4.7.1.el5_10 updates java-1.7.0-openjdk-demo.i386 1:1.7.0.55-2.4.7.1.el5_10 updates java-1.7.0-openjdk-devel.i386 1:1.7.0.55-2.4.7.1.el5_10 updates java-1.7.0-openjdk-javadoc.i386 1:1.7.0.55-2.4.7.1.el5_10 updates java-1.7.0-openjdk-src.i386 1:1.7.0.55-2.4.7.1.el5_10 updates java_cup.i386 1:0.10-0.k.6jpp.1 base java_cup-javadoc.i386 1:0.10-0.k.6jpp.1 base java_cup-manual.i386 1:0.10-0.k.6jpp.1 base javacc.i386 4.0-3jpp.3 base javacc-demo.i386 4.0-3jpp.3 base javacc-manual.i386 4.0-3jpp.3 base 2.使用root用戶安裝 安裝時提醒必須使用root用戶,sudo都不行。 [qyf@localhost ~]$ yum -y install java-1.6.0-openjdk* 執(zhí)行結(jié)果 [qyf@localhost ~]$ yum -y install java-1.6.0-openjdk* Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.bit.edu.cn * extras: mirror.bit.edu.cn * updates: centos.ustc.edu.cn base | 1.1 kB 00:00 base/primary | 995 kB 00:07 base 2789/2789 extras | 2.1 kB 00:00 extras/primary_db | 164 kB 00:02 updates | 1.9 kB 00:00 updates/primary_db | 422 kB 00:07 Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package java-1.6.0-openjdk.i386 1:1.6.0.0-5.1.13.3.el5_10 set to be updated --> Processing Dependency: jpackage-utils >= 1.7.3-1jpp.2 for package: java-1.6.0-openjdk --> Processing Dependency: libgif.so.4 for package: java-1.6.0-openjdk --> Processing Dependency: tzdata-java for package: java-1.6.0-openjdk ---> Package java-1.6.0-openjdk-demo.i386 1:1.6.0.0-5.1.13.3.el5_10 set to be updated ---> Package java-1.6.0-openjdk-devel.i386 1:1.6.0.0-5.1.13.3.el5_10 set to be updated ---> Package java-1.6.0-openjdk-javadoc.i386 1:1.6.0.0-5.1.13.3.el5_10 set to be updated ---> Package java-1.6.0-openjdk-src.i386 1:1.6.0.0-5.1.13.3.el5_10 set to be updated --> Running transaction check ---> Package giflib.i386 0:4.1.3-7.3.3.el5 set to be updated ---> Package jpackage-utils.noarch 0:1.7.3-1jpp.3.el5 set to be updated ---> Package tzdata-java.i386 0:2014b-1.el5 set to be updated --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: java-1.6.0-openjdk i386 1:1.6.0.0-5.1.13.3.el5_10 updates 44 M java-1.6.0-openjdk-demo i386 1:1.6.0.0-5.1.13.3.el5_10 updates 2.2 M java-1.6.0-openjdk-devel i386 1:1.6.0.0-5.1.13.3.el5_10 updates 15 M java-1.6.0-openjdk-javadoc i386 1:1.6.0.0-5.1.13.3.el5_10 updates 20 M java-1.6.0-openjdk-src i386 1:1.6.0.0-5.1.13.3.el5_10 updates 39 M Installing for dependencies: giflib i386 4.1.3-7.3.3.el5 base 39 k jpackage-utils noarch 1.7.3-1jpp.3.el5 base 60 k tzdata-java i386 2014b-1.el5 updates 172 k Transaction Summary ================================================================================ Install 8 Package(s) Upgrade 0 Package(s) Total download size: 120 M Downloading Packages: (1/8): giflib-4.1.3-7.3.3.el5.i386.rpm | 39 kB 00:00 (2/8): jpackage-utils-1.7.3-1jpp.3.el5.noarch.rpm | 60 kB 00:00 (3/8): tzdata-java-2014b-1.el5.i386.rpm | 172 kB 00:04 (4/8): java-1.6.0-openjdk-demo-1.6.0.0-5.1.13.3.el5_10.i386.rpm | 2.2 MB 00:47 (5/8): java-1.6.0-openjdk-devel-1.6.0.0-5.1.13.3.el5_10.i386.rpm | 15 MB 04:25 (6/8): java-1.6.0-openjdk-javadoc-1.6.0.0-5.1.13.3.el5_10.i386.rpm (17%) 19% [============ ] 81 kB/s | 3.8 MB 03:19 ETA 最后一行就是在下載jdk了,這里我們安裝jdk1.6相關(guān)得全部包。 3.確認(rèn)是否安裝成功 [qyf@localhost ~]$ java -version 執(zhí)行結(jié)果 [qyf@localhost ~]$ java -version java version "1.6.0_30" OpenJDK Runtime Environment (IcedTea6 1.13.3) (rhel-5.1.13.3.el5_10-i386) OpenJDK Client VM (build 23.25-b01, mixed mode) 正確顯示了jdk版本信息就說明安裝成功了。 4.默認(rèn)情況下jdk安裝得路徑 /usr/lib/jvm 由于我們得機(jī)器可能同時安裝好幾個版本得jdk,所以在/etc/alternatives目錄下會有一個java鏈接到具體的java命令。而這個/etc/alternatives/java會被/usr/bin/java鏈接。從而java命令就被設(shè)置到了shell環(huán)境中。 |
|