CentOS /RHEL: How To Install JAVA SDK Using YUM

I would like to install JAVA SDK package on my centos or rhel system. How  DO I Install JAVA SDK enviroment under centos or rhel operating system? How to install java sdk package? this post will show you out how to install java sdk(java software development kit).

​You need to use “java search” command to search all available jdk pakcages in the yum repository. type the following command:

yum search java | grep -i JDK

outputs:

[root@osetc/]# yum search java | grep -i --color JDK

ldapjdk-javadoc.x86_64 : Javadoc for ldapjdk

icedtea-web.x86_64 : Additional Java components for OpenJDK - Java browser

java-1.6.0-openjdk.x86_64 : OpenJDK Runtime Environment

java-1.6.0-openjdk-demo.x86_64 : OpenJDK Demos

java-1.6.0-openjdk-devel.x86_64 : OpenJDK Development Environment

java-1.6.0-openjdk-javadoc.x86_64 : OpenJDK API Documentation

java-1.6.0-openjdk-src.x86_64 : OpenJDK Source Bundle

java-1.7.0-openjdk.x86_64 : OpenJDK Runtime Environment

java-1.7.0-openjdk-demo.x86_64 : OpenJDK Demos

java-1.7.0-openjdk-devel.x86_64 : OpenJDK Development Environment

java-1.7.0-openjdk-javadoc.noarch : OpenJDK API Documentation

java-1.7.0-openjdk-src.x86_64 : OpenJDK Source Bundle

java-1.8.0-openjdk.x86_64 : OpenJDK Runtime Environment

java-1.8.0-openjdk-demo.x86_64 : OpenJDK Demos

java-1.8.0-openjdk-devel.x86_64 : OpenJDK Development Environment

java-1.8.0-openjdk-headless.x86_64 : OpenJDK Runtime Environment

java-1.8.0-openjdk-javadoc.noarch : OpenJDK API Documentation

java-1.8.0-openjdk-src.x86_64 : OpenJDK Source Bundle

ldapjdk.x86_64 : The Mozilla LDAP Java SDK

done....

CentOS Install JAVA SDK Development Kit


Type the following command to install java sdk package:

yum install java-1.7.0-openjdk java-1.7.0-openjdk-devel

outputs:

[root@osetc/]# yum install java-1.7.0-openjdk java-1.7.0-openjdk-devel

Loaded plugins: fastestmirror, refresh-packagekit, security

Loading mirror speeds from cached hostfile

 * base: mirrors.btte.net

 * extras: mirrors.btte.net

 * updates: mirrors.btte.net

Setting up Install Process

Resolving Dependencies

--> Running transaction check

---> Package java-1.7.0-openjdk.x86_64 1:1.7.0.71-2.5.3.1.el6 will be installed

--> Processing Dependency: libjpeg.so.62(LIBJPEG_6.2)(64bit) for package: 1:java-1.7.0-openjdk-1.7.0.71-2.5.3.1.el6.x86_64

---> Package java-1.7.0-openjdk-devel.x86_64 1:1.7.0.71-2.5.3.1.el6 will be installed

--> Running transaction check

---> Package libjpeg.x86_64 0:6b-46.el6 will be obsoleted

---> Package libjpeg-turbo.x86_64 0:1.2.1-3.el6_5 will be obsoleting

--> Finished Dependency Resolution

Dependencies Resolved

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

================================================================================
Installing:

 java-1.7.0-openjdk         x86_64   1:1.7.0.71-2.5.3.1.el6     updates    26 M

 java-1.7.0-openjdk-devel   x86_64   1:1.7.0.71-2.5.3.1.el6     updates   9.4 M

 libjpeg-turbo              x86_64   1.2.1-3.el6_5              base      174 k

     replacing  libjpeg.x86_64 6b-46.el6

Transaction Summary

================================================================================

Install       3 Package(s)

Total download size: 35 M

Is this ok [y/N]:

Is this ok [y/N]: y

Downloading Packages:

(1/3): java-1.7.0-openjdk-1.7.0.71-2.5.3.1.el6.x86_64.rp |  26 MB     00:16    

(2/3): java-1.7.0-openjdk-devel-1.7.0.71-2.5.3.1.el6.x86 | 9.4 MB     00:06    

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

--------------------------------------------------------------------------------

Total                                           1.6 MB/s |  35 MB     00:22    

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) <centos-6-key@centos.org>

 Package: centos-release-6-3.el6.centos.9.x86_64 (@anaconda-CentOS-201207061011.x86_64/6.3)

 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

Is this ok [y/N]: y

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing : libjpeg-turbo-1.2.1-3.el6_5.x86_64                           1/4

  Installing : 1:java-1.7.0-openjdk-1.7.0.71-2.5.3.1.el6.x86_64             2/4

  Installing : 1:java-1.7.0-openjdk-devel-1.7.0.71-2.5.3.1.el6.x86_64       3/4

  Erasing    : libjpeg-6b-46.el6.x86_64                                     4/4

  Verifying  : 1:java-1.7.0-openjdk-1.7.0.71-2.5.3.1.el6.x86_64             1/4

  Verifying  : libjpeg-turbo-1.2.1-3.el6_5.x86_64                           2/4

  Verifying  : 1:java-1.7.0-openjdk-devel-1.7.0.71-2.5.3.1.el6.x86_64       3/4

  Verifying  : libjpeg-6b-46.el6.x86_64                                     4/4

Installed:

  java-1.7.0-openjdk.x86_64 1:1.7.0.71-2.5.3.1.el6                              

  java-1.7.0-openjdk-devel.x86_64 1:1.7.0.71-2.5.3.1.el6                        

  libjpeg-turbo.x86_64 0:1.2.1-3.el6_5                                          

Replaced:

  libjpeg.x86_64 0:6b-46.el6                                                    

Complete!

CentOS Set JAVA_HOME Enviroment Variable


The Java SDK package is installed in “/usr/lib/jvm” directory by default. using the following commnad to list all files and find one directory that contains “bin/java” file.

ls -l /usr/lib/jvm

outputs:

[root@osetc/]# ls -l /usr/lib/jvm

total 8

lrwxrwxrwx. 1 root root   26 Dec 14 04:13 java -> /etc/alternatives/java_sdk

drwxr-xr-x. 3 root root 4096 Nov 26 14:42 java-1.6.0-openjdk-1.6.0.0.x86_64

lrwxrwxrwx. 1 root root   32 Dec 14 04:13 java-1.7.0 -> /etc/alternatives/java_sdk_1.7.0

drwxr-xr-x. 7 root root 4096 Dec 14 04:13 java-1.7.0-openjdk-1.7.0.71.x86_64

lrwxrwxrwx. 1 root root   34 Dec 14 04:13 java-1.7.0-openjdk.x86_64 -> java-1.7.0-openjdk-1.7.0.71.x86_64

lrwxrwxrwx. 1 root root   34 Dec 14 04:13 java-openjdk -> /etc/alternatives/java_sdk_openjdk

lrwxrwxrwx. 1 root root   21 Dec 14 04:12 jre -> /etc/alternatives/jre

lrwxrwxrwx. 1 root root   27 Nov 26 14:42 jre-1.6.0 -> /etc/alternatives/jre_1.6.0

lrwxrwxrwx. 1 root root   37 Nov 26 14:42 jre-1.6.0-openjdk.x86_64 -> java-1.6.0-openjdk-1.6.0.0.x86_64/jre

lrwxrwxrwx. 1 root root   27 Dec 14 04:12 jre-1.7.0 -> /etc/alternatives/jre_1.7.0

lrwxrwxrwx. 1 root root   38 Dec 14 04:12 jre-1.7.0-openjdk.x86_64 -> java-1.7.0-openjdk-1.7.0.71.x86_64/jre

lrwxrwxrwx. 1 root root   29 Dec 14 04:12 jre-openjdk -> /etc/alternatives/jre_openjdk

set JAVA_HOME variable to the directory"/usr/lib/jvm/jre-1.7.0-openjdk.x86_64".type:

export JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk.x86_64

done….

You might also like:

Sidebar



back to top