CentOS使用yum安装jdk7


安装JDK1.7

  1. 查找java相关得列表
    [root@iZ28..... ~]# yum -y list java*
    执行后:

    Loaded plugins: security
    base/primary_db | 3.6 MB 00:03
    epel/primary_db | 5.0 MB 00:04
    extras/primary_db | 30 kB 00:00
    updates/primary_db | 3.7 MB 00:03
    Available Packages
    java-1.5.0-gcj.i686 1.5.0.0-29.1.el6 base
    java-1.5.0-gcj-devel.i686 1.5.0.0-29.1.el6 base
    java-1.5.0-gcj-javadoc.i686 1.5.0.0-29.1.el6 base
    java-1.5.0-gcj-src.i686 1.5.0.0-29.1.el6 base
    java-1.6.0-openjdk.i686 1:1.6.0.38-1.13.10.0.el6_7 updates
    java-1.6.0-openjdk-demo.i686 1:1.6.0.38-1.13.10.0.el6_7 updates
    java-1.6.0-openjdk-devel.i686 1:1.6.0.38-1.13.10.0.el6_7 updates
    java-1.6.0-openjdk-javadoc.i686 1:1.6.0.38-1.13.10.0.el6_7 updates
    java-1.6.0-openjdk-src.i686 1:1.6.0.38-1.13.10.0.el6_7 updates
    java-1.7.0-openjdk.i686 1:1.7.0.95-2.6.4.0.el6_7 updates
    java-1.7.0-openjdk-demo.i686 1:1.7.0.95-2.6.4.0.el6_7 updates
    java-1.7.0-openjdk-devel.i686 1:1.7.0.95-2.6.4.0.el6_7 updates
    java-1.7.0-openjdk-javadoc.noarch 1:1.7.0.95-2.6.4.0.el6_7 updates
    java-1.7.0-openjdk-src.i686 1:1.7.0.95-2.6.4.0.el6_7 updates
    java-1.8.0-openjdk.i686 1:1.8.0.71-1.b15.el6_7 updates
    java-1.8.0-openjdk-debug.i686 1:1.8.0.71-1.b15.el6_7 updates
    java-1.8.0-openjdk-demo.i686 1:1.8.0.71-1.b15.el6_7 updates
    java-1.8.0-openjdk-demo-debug.i686 1:1.8.0.71-1.b15.el6_7 updates
    java-1.8.0-openjdk-devel.i686 1:1.8.0.71-1.b15.el6_7 updates
    java-1.8.0-openjdk-devel-debug.i686 1:1.8.0.71-1.b15.el6_7 updates
    java-1.8.0-openjdk-headless.i686 1:1.8.0.71-1.b15.el6_7 updates
    java-1.8.0-openjdk-headless-debug.i686 1:1.8.0.71-1.b15.el6_7 updates
    java-1.8.0-openjdk-javadoc.noarch 1:1.8.0.71-1.b15.el6_7 updates
    java-1.8.0-openjdk-javadoc-debug.noarch 1:1.8.0.71-1.b15.el6_7 updates
    java-1.8.0-openjdk-src.i686 1:1.8.0.71-1.b15.el6_7 updates
    java-1.8.0-openjdk-src-debug.i686 1:1.8.0.71-1.b15.el6_7 updates
    java-clearsilver.i686 0.10.5-15.el6 epel
    java-dirq.noarch 1.4-1.el6 epel
    java-dirq-javadoc.noarch 1.4-1.el6 epel
    java-sleep.noarch 2.1-6.el6 epel
    java-sleep-javadoc.noarch 2.1-6.el6 epel
    java_cup.i686 1:0.10k-5.el6 base
    java_cup-javadoc.i686 1:0.10k-5.el6 base
    java_cup-manual.i686 1:0.10k-5.el6 base
    javacc.i686 4.1-0.5.el6 base
    javacc-demo.i686 4.1-0.5.el6 base
    javacc-manual.i686 4.1-0.5.el6 base
    javassist.noarch 3.9.0-6.el6 base
    javassist-javadoc.noarch 3.9.0-6.el6 base
    javastroke.i686 0.5.1-24.el6 epel
    javatar.noarch 2.5-5.el6 epel
    javatar-javadoc.noarch 2.5-5.el6 epel
  2. 使用root用户安装
    安装时提醒必须使用root用户,sudo都不行
    [root@iZ28..... ~]# yum -y install java-1.7.0-openjdk*
    执行后 :

    Loaded plugins: security
    base/primary_db | 3.6 MB 00:03
    epel/primary_db | 5.0 MB 00:04
    extras/primary_db | 30 kB 00:00
    updates/primary_db | 3.7 MB 00:03
    Available Packages
    java-1.5.0-gcj.i686 1.5.0.0-29.1.el6 base
    java-1.5.0-gcj-devel.i686 1.5.0.0-29.1.el6 base
    java-1.5.0-gcj-javadoc.i686 1.5.0.0-29.1.el6 base
    java-1.5.0-gcj-src.i686 1.5.0.0-29.1.el6 base
    java-1.6.0-openjdk.i686 1:1.6.0.38-1.13.10.0.el6_7 updates
    java-1.6.0-openjdk-demo.i686 1:1.6.0.38-1.13.10.0.el6_7 updates
    java-1.6.0-openjdk-devel.i686 1:1.6.0.38-1.13.10.0.el6_7 updates
    java-1.6.0-openjdk-javadoc.i686 1:1.6.0.38-1.13.10.0.el6_7 updates
    java-1.6.0-openjdk-src.i686 1:1.6.0.38-1.13.10.0.el6_7 updates
    java-1.7.0-openjdk.i686 1:1.7.0.95-2.6.4.0.el6_7 updates
    java-1.7.0-openjdk-demo.i686 1:1.7.0.95-2.6.4.0.el6_7 updates
    java-1.7.0-openjdk-devel.i686 1:1.7.0.95-2.6.4.0.el6_7 updates
    java-1.7.0-openjdk-javadoc.noarch 1:1.7.0.95-2.6.4.0.el6_7 updates
    java-1.7.0-openjdk-src.i686 1:1.7.0.95-2.6.4.0.el6_7 updates
    java-1.8.0-openjdk.i686 1:1.8.0.71-1.b15.el6_7 updates
    java-1.8.0-openjdk-debug.i686 1:1.8.0.71-1.b15.el6_7 updates
    java-1.8.0-openjdk-demo.i686 1:1.8.0.71-1.b15.el6_7 updates
    java-1.8.0-openjdk-demo-debug.i686 1:1.8.0.71-1.b15.el6_7 updates
    java-1.8.0-openjdk-devel.i686 1:1.8.0.71-1.b15.el6_7 updates
    java-1.8.0-openjdk-devel-debug.i686 1:1.8.0.71-1.b15.el6_7 updates
    java-1.8.0-openjdk-headless.i686 1:1.8.0.71-1.b15.el6_7 updates
    java-1.8.0-openjdk-headless-debug.i686 1:1.8.0.71-1.b15.el6_7 updates
    java-1.8.0-openjdk-javadoc.noarch 1:1.8.0.71-1.b15.el6_7 updates
    java-1.8.0-openjdk-javadoc-debug.noarch 1:1.8.0.71-1.b15.el6_7 updates
    java-1.8.0-openjdk-src.i686 1:1.8.0.71-1.b15.el6_7 updates
    java-1.8.0-openjdk-src-debug.i686 1:1.8.0.71-1.b15.el6_7 updates
    java-clearsilver.i686 0.10.5-15.el6 epel
    java-dirq.noarch 1.4-1.el6 epel
    java-dirq-javadoc.noarch 1.4-1.el6 epel
    java-sleep.noarch 2.1-6.el6 epel
    java-sleep-javadoc.noarch 2.1-6.el6 epel
    java_cup.i686 1:0.10k-5.el6 base
    java_cup-javadoc.i686 1:0.10k-5.el6 base
    java_cup-manual.i686 1:0.10k-5.el6 base
    javacc.i686 4.1-0.5.el6 base
    javacc-demo.i686 4.1-0.5.el6 base
    javacc-manual.i686 4.1-0.5.el6 base
    javassist.noarch 3.9.0-6.el6 base
    javassist-javadoc.noarch 3.9.0-6.el6 base
    javastroke.i686 0.5.1-24.el6 epel
    javatar.noarch 2.5-5.el6 epel
    javatar-javadoc.noarch 2.5-5.el6 epel
  3. 确认是否安装成功 执行 [root@iZ2... ~]# java -version.
    执行结果:

    java version "1.7.0_95"
    OpenJDK Runtime Environment (rhel-2.6.4.0.el6_7-i386 u95-b00)
    OpenJDK Client VM (build 24.95-b01, mixed mode, sharing)


4. 默认情况下jdk安装路径:/usr/lib/jvm

由于我们得机器可能同时安装好几个版本得jdk,所以在/etc/alternatives目录下会有一个java链接到具体的java命令。而这个/etc/alternatives/java会被/usr/bin/java链接。从而java命令就被设置到了shell环境中。


给个github follow me的链接,上面有很多初学者可供学习的资料,项目.

https://github.com/SuperZee

你可能感兴趣的:(CentOS使用yum安装jdk7)