Skip to content

Java Installation – Centos 7.x

Step-1: Environment

Centos 7.x 64bit VM
Google Cloud Platform
Binary installation

Step-2: Download Binaries

$ cd /opt
$ sudo wget --no-cookies --no-check-certificate --header "Cookie:; oraclelicense=accept-securebackup-cookie" ""

Step-3: Extract the Binaries

$ sudo tar xzf jdk-8u141-linux-x64.tar.gz

Step-4: Install using alternatives

$ cd /opt/jdk1.8.0_141

$ sudo alternatives --install /usr/bin/java java /opt/jdk1.8.0_141/bin/java 2;
$ sudo alternatives --install /usr/bin/jar jar /opt/jdk1.8.0_141/bin/jar 2;
$ sudo alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_141/bin/javac 2;
$ sudo alternatives --set jar /opt/jdk1.8.0_141/bin/jar;
$ sudo alternatives --set javac /opt/jdk1.8.0_141/bin/javac;

Step-5: Check the installation

$ java -version

java version "1.8.0_144"
java(TM) SE Runtime Environment (build 1.8.0_144-b01)
java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

Step-6: Setting Environmental Variables

$ sudo vi /etc/profile.d/

export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin

$ sudo chmod +x
$ source /etc/profile.d/

Shashi View All

A passionate devops and automation engineer

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: