1.查找java相关得列表
[qyf@localhost ~]$ yum -y list java*
-
[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*
-
[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相关得全部包。
3.确认是否安装成功
[qyf@localhost ~]$ java -version
-
[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.默认情况下jdk安装得路径
/usr/lib/jvm
由于我们得机器可能同时安装好几个版本得jdk,所以在
/etc/alternatives目录下会有一个java链接到具体的java命令。而这个/etc/alternatives/java会被/usr/bin/java链接。从而java命令就被设置到了shell环境中。
阅读(64296) | 评论(0) | 转发(2) |