Installing the JDK with Yum on Linux

Source: Internet
Author: User
Tags gpg aliyun

1. Find Java-related lists
[root@localhost ~]# yum-y list java*
Loaded Plugins:fastestmirror, Refresh-packagekit, security
Loading mirror speeds from cached hostfile

  • base:mirrors.zju.edu.cn
  • Extras:mirrors.aliyun.com
  • Updates:mirrors.aliyun.com
    Base | 3.7 KB 00:00
    Extras | 3.4 KB 00:00
    Updates | 3.4 KB 00:00
    Installed Packages
    java-1.5.0-gcj.x86_64 1.5.0.0-29.1.el6 @base/$releasever
    java-1.6.0-openjdk.x86_64 1:1.6.0.0-1.45.1.11.1.el6 @base/$releasever
    java_cup.x86_64 1:0.10k-5.el6 @base/$releasever
    Available Packages
    java-1.5.0-gcj-devel.x86_64 1.5.0.0-29.1.EL6 Base
    java-1.5.0-gcj-javadoc.x86_64 1.5.0.0-29.1.EL6 Base
    java-1.5.0-gcj-src.x86_64 1.5.0.0-29.1.EL6 Base
    java-1.6.0-openjdk.x86_64 1:1.6.0.35-1.13.7.1.el6_6 Updates
    java-1.6.0-openjdk-demo.x86_64 1:1.6.0.35-1.13.7.1.el6_6 Updates
    java-1.6.0-openjdk-devel.x86_64 1:1.6.0.35-1.13.7.1.el6_6 Updates
    java-1.6.0-openjdk-javadoc.x86_64 1:1.6.0.35-1.13.7.1.el6_6 Updates
    java-1.6.0-openjdk-src.x86_64 1:1.6.0.35-1.13.7.1.el6_6 Updates
    java-1.7.0-openjdk.x86_64 1:1.7.0.79-2.5.5.1.el6_6 Updates
    java-1.7.0-openjdk-demo.x86_64 1:1.7.0.79-2.5.5.1.el6_6 Updates
    java-1.7.0-openjdk-devel.x86_64 1:1.7.0.79-2.5.5.1.el6_6 Updates
    Java-1.7.0-openjdk-javadoc.noarch 1:1.7.0.79-2.5.5.1.el6_6 Updates
    java-1.7.0-openjdk-src.x86_64 1:1.7.0.79-2.5.5.1.el6_6 Updates
    java-1.8.0-openjdk.x86_64 1:1.8.0.45-28.b13.el6_6 Updates
    java-1.8.0-openjdk-demo.x86_64 1:1.8.0.45-28.b13.el6_6 Updates
    java-1.8.0-openjdk-devel.x86_64 1:1.8.0.45-28.b13.el6_6 Updates
    java-1.8.0-openjdk-headless.x86_64 1:1.8.0.45-28.b13.el6_6 Updates
    Java-1.8.0-openjdk-javadoc.noarch 1:1.8.0.45-28.b13.el6_6 Updates
    java-1.8.0-openjdk-src.x86_64 1:1.8.0.45-28.b13.el6_6 Updates
    java_cup-javadoc.x86_64 1:0.10K-5.EL6 Base
    java_cup-manual.x86_64 1:0.10K-5.EL6 Base
    javacc.x86_64 4.1-0.5.EL6 Base
    javacc-demo.x86_64 4.1-0.5.EL6 Base
    javacc-manual.x86_64 4.1-0.5.EL6 Base
    Javassist.noarch 3.9.0-6.EL6 Base
    Javassist-javadoc.noarch 3.9.0-6.EL6 Base

2. Install using the root user
The installation reminder must use the root user and sudo will not work.
[root@localhost ~]# yum-y Install java-1.7.0-openjdk*
Loaded Plugins:fastestmirror, Refresh-packagekit, security
Loading mirror speeds from cached hostfile

  • base:mirrors.zju.edu.cn
  • Extras:mirrors.aliyun.com
  • Updates:mirrors.aliyun.com
    Setting up Install Process
    Resolving Dependencies
    –> Running Transaction Check
    Package java-1.7.0-openjdk.x86_64 1:1.7.0.79-2.5.5.1.el6_6 would be installed
    –> processing dependency:libjpeg.so.62 (libjpeg_6.2) (64bit) for package:1: Java-1.7.0-openjdk-1.7.0.79-2.5.5.1.el6_6.x86_64
    Package java-1.7.0-openjdk-demo.x86_64 1:1.7.0.79-2.5.5.1.el6_6 would be installed
    Package java-1.7.0-openjdk-devel.x86_64 1:1.7.0.79-2.5.5.1.el6_6 would be installed
    Package Java-1.7.0-openjdk-javadoc.noarch 1:1.7.0.79-2.5.5.1.el6_6 would be installed
    Package java-1.7.0-openjdk-src.x86_64 1:1.7.0.79-2.5.5.1.el6_6 would be installed
    –> Running Transaction Check
    Package libjpeg.x86_64 0:6b-46.el6 would be obsoleted
    Package libjpeg-turbo.x86_64 0:1.2.1-3.el6_5 would be obsoleting
    –> finished Dependency Resolution

Dependencies resolved

================================================================================
Package Arch Version Repository

                                                                       Size

================================================================================
Installing:
JAVA-1.7.0-OPENJDK x86_64 1:1.7.0.79-2.5.5.1.el6_6 Updates M
Java-1.7.0-openjdk-demo x86_64 1:1.7.0.79-2.5.5.1.el6_6 Updates 1.9 M
Java-1.7.0-openjdk-devel x86_64 1:1.7.0.79-2.5.5.1.el6_6 Updates 9.4 M
Java-1.7.0-openjdk-javadoc noarch 1:1.7.0.79-2.5.5.1.el6_6 Updates M
JAVA-1.7.0-OPENJDK-SRC x86_64 1:1.7.0.79-2.5.5.1.el6_6 Updates M
Libjpeg-turbo x86_64 1.2.1-3.el6_5 Base 174 k

 replacing  libjpeg.x86_64 6b-46.el6
Transaction Summary

Install 6 Package (s)

Total Download size:92 M
Downloading Packages:
(1/6): java-1.7.0-openjdk-1.7.0.79-2.5.5.1.el6_6.x86_64. | MB 02:44
(2/6): java-1.7.0-openjdk-demo-1.7.0.79-2.5.5.1.el6_6.x8 | 1.9 MB 00:10
(3/6): java-1.7.0-openjdk-devel-1.7.0.79-2.5.5.1.el6_6.x | 9.4 MB 01:23
(4/6): Java-1.7.0-openjdk-javadoc-1.7.0.79-2.5.5.1.el6_6 | MB 02:16
(5/6): java-1.7.0-openjdk-src-1.7.0.79-2.5.5.1.el6_6.x86 | (MB) 04:23

(6/6): libjpeg-turbo-1.2.1-3.el6_5.x86_64.rpm | 174 KB 00:00

Total 143 kb/s | MB 11:03
Warning:rpmts_HdrFromFdno:Header V3 rsa/sha1 Signature, key ID C105b9de:nokey
Retrieving Key from File:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xc105b9de:
Userid:centos-6 Key (CentOS 6 official Signing Key)[email protected]
Package:centos-release-6-3.el6.centos.9.x86_64 (@base/$releasever)
From:/etc/pki/rpm-gpg/rpm-gpg-key-centos-6
Running Rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing:libjpeg-turbo-1.2.1-3.el6_5.x86_64 1/7
Installing:1:java-1.7.0-openjdk-1.7.0.79-2.5.5.1.el6_6.x86_64 2/7
Installing:1:java-1.7.0-openjdk-src-1.7.0.79-2.5.5.1.el6_6.x86_64 3/7
Installing:1:java-1.7.0-openjdk-demo-1.7.0.79-2.5.5.1.el6_6.x86_64 4/7
Installing:1:java-1.7.0-openjdk-devel-1.7.0.79-2.5.5.1.el6_6.x86_64 5/7
Installing:1:java-1.7.0-openjdk-javadoc-1.7.0.79-2.5.5.1.el6_6.noarch 6/7
Erasing:libjpeg-6b-46.el6.x86_64 7/7
Verifying:1:java-1.7.0-openjdk-src-1.7.0.79-2.5.5.1.el6_6.x86_64 1/7
Verifying:1:java-1.7.0-openjdk-1.7.0.79-2.5.5.1.el6_6.x86_64 2/7
Verifying:1:java-1.7.0-openjdk-javadoc-1.7.0.79-2.5.5.1.el6_6.noarch 3/7
Verifying:1:java-1.7.0-openjdk-demo-1.7.0.79-2.5.5.1.el6_6.x86_64 4/7
Verifying:1:java-1.7.0-openjdk-devel-1.7.0.79-2.5.5.1.el6_6.x86_64 5/7
Verifying:libjpeg-turbo-1.2.1-3.el6_5.x86_64 6/7
Verifying:libjpeg-6b-46.el6.x86_64 7/7

Installed:
Java-1.7.0-openjdk.x86_64 1:1.7.0.79-2.5.5.1.el6_6
Java-1.7.0-openjdk-demo.x86_64 1:1.7.0.79-2.5.5.1.el6_6
Java-1.7.0-openjdk-devel.x86_64 1:1.7.0.79-2.5.5.1.el6_6
Java-1.7.0-openjdk-javadoc.noarch 1:1.7.0.79-2.5.5.1.el6_6
Java-1.7.0-openjdk-src.x86_64 1:1.7.0.79-2.5.5.1.el6_6
Libjpeg-turbo.x86_64 0:1.2.1-3.el6_5

Replaced:
Libjpeg.x86_64 0:6b-46.el6

complete!

3. Confirm that the installation is successful

[Root@localhost ~]# Java-version
Java Version "1.7.0_79"
OpenJDK Runtime Environment (rhel-2.5.5.1.el6_6-x86_64 u79-b14)
OpenJDK 64-bit Server VM (build 24.79-b02, Mixed mode)
[Root@localhost ~]# Javac
Usage:javac
Where possible options include:
-G Generate All debugging Info
-g:none Generate No debugging Info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate No warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are used
-classpath specify where to find user class files and annotation processors
-CP specify where to find user class files and annotation processors
-sourcepath specify where to find input source files
-bootclasspath Override location of bootstrap class files
-extdirs Override location of installed extensions
-endorseddirs Override location of endorsed standards path
-proc:{none,only} Control whether annotation processing and/or compilation is done.
-processor [,, ...] Names of the annotation processors to run; Bypasses default discovery process
-processorpath specify where to find annotation processors
-D specify where to place generated class files
-S specify where to place generated source files
-implicit:{none,class} Specify whether or not to generate class files for implicitly referenced files
-encoding specify character encoding used by source files
-source provide source compatibility with specified release
-target Generate class files for specific VM version
-version Version Information
-help Print A synopsis of standard options
-akey[=value] Options to pass to annotation processors
-X Print A synopsis of nonstandard options
-j Pass directly to the runtime system
-werror Terminate Compilation If warnings occur
@ Read options and filenames from file

[Root@localhost ~]# Java
Usage:java [-options] class [args ...]

       (to execute a class)

or Java [-options]-jar jarfile [args ...]

       (to execute a jar file)

Where options include:

              Load Java programming language agent, see JAVA.LANG.INSTRUMENT-D64 Use a 64-bit data model if avail  Able-server to select the ' server ' VM the default VM is SERVER.-CP <class search path of directories and Zip/jar files>-classpath <class search Path of directories and Zip/jar files> a:separated lis              T of directories, JAR archives, and ZIP archives to search for class files.-d<name>=<value>  Set a system Property-verbose:[class|gc|jni] enable verbose output-version print product version And exit-version:<value> require the specified version to run-showversion print product version and C Ontinue-jre-restrict-search | -no-jre-restrict-search include/exclude User Private JREs in the version search-? -help Print this Help message-x print help on non-standard Options-ea[:<packagename>...|:<classna Me>]-enableassertiOns[:<packagename>...|:<classname>] enable assertions with specified Granularity-da[:<packagen Ame>...|:<classname>]-disableassertions[:<packagename>...|:<classname>] Disable Assertio NS with specified Granularity-esa | -enablesystemassertions Enable System ASSERTIONS-DSA | -disablesystemassertions disable system assertions-agentlib:<libname>[=<options>] Lo Ad native Agent library <libname>, e.g.-agentlib:hprof See also,-agentlib:jdwp=help AND-AGENTLIB:HPR Of=help-agentpath:<pathname>[=<options>] Load native Agent library by full pathname-javaagent:&lt ; jarpath>[=<options>] Load Java programming language agent, see Java.lang.instrument-splash:<imag Epath> Show splash screen with specified image

See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.

4. JDK installation path by default
/usr/lib/jvm
Since our machine may have several versions of the JDK installed at the same time, there will be a Java link to the specific Java command in the/etc/alternatives directory. And this/etc/alternatives/java will be/usr/bin/java link. The Java command is then set to the shell environment.

Installing the JDK with Yum on Linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.