Tuesday 27 February 2018

How to install java in rhel/centos

Step 1

Download the required java version from below java archive link.

for 6

JAVA 6

for 7

JAVA 7

for 8

JAVA 8

Step 2

Extract the package in =to the required directory.

tar -xzf jdk-XUxx-linux-xxx.tar.gz

Step 3

Install the java with alternatives.

go to the java directory that you have extracted.

cd /opt/jdkx.x.x_xx/

install with below command

alternatives --install /usr/bin/java java /opt/jdkx.x_xx/bin/java 2

now select that which you want to be default to work with below command

alternatives --config java

example output

There are 4 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*  1           /opt/jdk1.6.0_xx/bin/java
 + 2           /opt/jdk1.7.0_xx/bin/java
   3           /opt/jdk1.8.0_144/bin/java
   4           /opt/jdk1.8.0_xxx/bin/java

Enter to keep the current selection[+], or type selection number: 

In this java has been installed still we need to setup javac and jar command with alternatives.

Step 4

With the following command we can install jar and javac

alternatives --install /usr/bin/jar jar /opt/jdkx.x.x_xx/bin/jar 2

alternatives --install /usr/bin/javac javac /opt/jdkx.x.x_xx/bin/javac 2

alternatives --set jar /opt/jdkx.x.x_xx/bin/jar

alternatives --set javac /opt/jdkx.x.x_xx/bin/javac

Now check the java version with below command

java -version

Step 5

Set JAVA home in to the bash_profile

export JAVA_HOME=/opt/jdkx.x.x_xx

export JRE_HOME=/opt/jdkx.x.x_xx/jre

export PATH=$PATH:/opt/jdkx.x.x_xx/bin:/opt/jdkx.x.x_xx/jre/bin

that's all now you can use java.

How to install Apaceh ant in linux

What is Apache Ant?

ANT stands for Another Neat Tool. It's an open source tool for automating java program build process. Ant's build files are written in XML and they take advantage of being open standard, portable and easy to understand.

It simplify the developers works like compiling the code, packaging the binaries, deploying the binaries to the test server, testing the changes and copying the code from one location to another to simply automate it.

Now we are going to see how to install it.

Step 1

Download the package that you are required from mentioned link below.

 https://archive.apache.org/dist/ant/binaries/

Step 2

Extract the package to required location.

cd /opt

tar xzf apache-ant-x.x.x-bin.tar.gz

now rename the directory 

mv apache-ant-x.x.x ant

Step 3

Setup HOME directory in environment 

sh -c 'echo ANT_HOME=/opt/ant >> /etc/environment'

now link the binary 

ln -s /opt/ant/bin/ant /usr/bin/ant

Now check the ant version with below command

ant -version

sample example above command result

 

Note Java is need to installed o this server.
 

Permanent hostname setup for RHEL7

Step 1 Set the host name on NMTUI tool like following nmtui set host name   then save and exit Step 2 add the following l...