Author Photo

Ahmer's SysAdmin Recipes is a blog for Linux System Administrators. This blog provides recipes for Installation & Configuration of Linux, Ubuntu, Oracle Database, MySQL, Apache, Nginx, Oracle Cloud Control, FreeIPA, Kerberos & OpenLDAP, Subversion, PXE, DevOps, etc. over Red Hat Enterprise Linux (RHEL), CentOS, Ubuntu and Windows.

Please give me your feedback and help me improve this blog. Please let me know If you want me to write on a specific topic.

Monday, 24 December 2018

Install Java JDK 11 from RPM/TAR on CentOS 7

Install-Java-Development-Kit-JDK-11-on-CentOS-7Java JDK or Java Development Kit is an implementation of Java Platform. JDK includes a private Java Virtual Machine (JVM) and few other resources to facilitate the development of Java applications. JDK is an essential tool required by all Java based applications. Currently, it is the most widely used Software Development Kit (SDK).

In this article, we will install Java JDK 11 on CentOS 7 server from RPM and from tarball.

 

Installing Java JDK 11 from RPM on CentOS 7:

Connect to appserver-01.example.com using ssh as root user.

Download Java JDK 11 RPM for CentOS 7 from Oracle Technical Network (OTN) and copy it to the home directory of root user.

Install the downloaded package using rpm command.

[root@appserver-01 ~]# rpm -ivh jdk-11.0.1_linux-x64_bin.rpm warning: jdk-11.0.1_linux-x64_bin.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY Preparing... ################################# [100%] Updating / installing... 1:jdk-11.0.1-2000:11.0.1-ga ################################# [100%]

Set JAVA_HOME environment variable.

[root@appserver-01 ~]# echo "export JAVA_HOME=/usr/java/jdk-11.0.1" >> /etc/profile [root@appserver-01 ~]# export JAVA_HOME=/usr/java/jdk-11.0.1

Verify installation of Java JDK 11 by executing java command.

[root@appserver-01 ~]# java -version java version "11.0.1" 2018-10-16 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)

Java JDK 11 has been installed from RPM Package on CentOS 7 server.

 

Installing Java JDK 11 from TAR on CentOS 7:

Connect to appserver-01.example.com using ssh as root user.

Download Java JDK 11 TAR for CentOS 7 from Oracle Technical Network (OTN) and copy it to the home directory of root user.

Extract downloaded tarball using tar command.

[root@appserver-01 ~]# mkdir /usr/java [root@appserver-01 ~]# tar xvf jdk-11.0.1_linux-x64_bin.tar.gz -C /usr/java/ ... jdk-11.0.1/lib/server/libjsig.so jdk-11.0.1/lib/server/libjvm.so jdk-11.0.1/lib/src.zip jdk-11.0.1/lib/tzdb.dat jdk-11.0.1/release [root@appserver-01 ~]# ls /usr/java/ jdk-11.0.1

Set JAVA_HOME environment variable.

[root@appserver-01 ~]# echo "export JAVA_HOME=/usr/java/jdk-11.0.1" >> /etc/profile [root@appserver-01 ~]# export JAVA_HOME=/usr/java/jdk-11.0.1

Create the symbolic link for java using alternatives command.

[root@appserver-01 ~]# alternatives --install /usr/bin/java java /usr/java/jdk-11.0.1/bin/java 2 [root@appserver-01 ~]# alternatives --config java There is 1 program that provides 'java'. Selection Command ----------------------------------------------- *+ 1 /usr/java/jdk-11.0.1/bin/java Enter to keep the current selection[+], or type selection number:

We have only one JDK/JRE installed on this server, therefore, press ENTER to keep the current selection.

Create the symbolic link for javac using alternatives command.

[root@appserver-01 ~]# alternatives --install /usr/bin/javac javac /usr/java/jdk-11.0.1/bin/javac 2 [root@appserver-01 ~]# alternatives --config javac There is 1 program that provides 'javac'. Selection Command ----------------------------------------------- *+ 1 /usr/java/jdk-11.0.1/bin/javac Enter to keep the current selection[+], or type selection number:

Press ENTER.

Create the symbolic link for jar using alternatives command.

[root@appserver-01 ~]# alternatives --install /usr/bin/jar jar /usr/java/jdk-11.0.1/bin/jar 2 [root@appserver-01 ~]# alternatives --config jar There is 1 program that provides 'jar'. Selection Command ----------------------------------------------- *+ 1 /usr/java/jdk-11.0.1/bin/jar Enter to keep the current selection[+], or type selection number:

Press ENTER

Verify installation of Java JDK 11 by executing java command.

[root@appserver-01 ~]# java -version java version "11.0.1" 2018-10-16 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)

Java JDK 11 has been installed from TAR on CentOS 7 server.

Install Java JDK 11 from RPM/TAR on CentOS 7


YOU MIGHT ALSO LIKE:

No comments:

Post a Comment