# Setup Java 8 on host, in order to use site-wide through glusterfs,

# Working enviroments : host, user
#
# Get Java SE 8u5 from

http://www.oracle.com/technetwork/java/javase/downloads/index.html

# via JDK download link, which can forward me to the following

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html


# Enable the radio button of Accept License Agreement, and follow the download link of Linux x64, tar.gz  jdk-8u5-linux-x64.tar.gz


user@host:/data/programs$ tar xvzf jdk-8u5-linux-x64.tar.gz

user@host:/data/programs$ cd jdk1.8.0_05/

user@host:/data/programs/jdk1.8.0_05$ ls
bin/       include/        lib/     README.html  THIRDPARTYLICENSEREADME-JAVAFX.txt
COPYRIGHT  javafx-src.zip  LICENSE  release      THIRDPARTYLICENSEREADME.txt
db/        jre/            man/     src.zip


#
# Working enviroments : your localhost, your local user account
#                     e.g., client, auser or root
#

# If you setup the glusterfs correctly according to elog, so your jdk 8 directory should be
#  /mnt/glusterfs/programs/jdk1.8.0_05/
#
# Switch your local accout to su accout as root, if you run the update-alternatives --config java
# you might see the similar output as follows :

root@client:/home/auser/Desktop/OpenLDAP# update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   1061      auto mode
  1            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   1061      manual mode
* 2            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1051      manual mode

Press enter to keep the current choice[*], or type selection number:

# Now, we are starting to 'install' our java8 by Debian way.

root@client:~/local_installations# update-alternatives --install /usr/bin/java java /mnt/glusterfs/programs/jdk1.8.0_05/bin/java 1041
root@client:~/local_installations# update-alternatives --install /usr/bin/javac javac /mnt/glusterfs/programs/jdk1.8.0_05/bin/javac 1041

# If you have some typo and want to remove them, --remove option will help

root@client:~/local_installations# update-alternatives --remove  java /mnt/glusterfs/programs/jdk1.8.0_05/bin/java

#
# after them, now we have one more entry for java,
#

root@client:/home/auser/Desktop/OpenLDAP# update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   1061      auto mode
  1            /mnt/glusterfs/programs/jdk1.8.0_05/bin/java     1041      manual mode
  2            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   1061      manual mode
* 3            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1051      manual mode

#
# I selected 1041 priority, because 'update-alternative --auto java' can select automatically java 6 provided by Debian.
# Re-run the command, and type selection number 1


root@client:/home/auser/Desktop/OpenLDAP# update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   1061      auto mode
  1            /mnt/glusterfs/programs/jdk1.8.0_05/bin/java     1041      manual mode
  2            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   1061      manual mode
* 3            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1051      manual mode

Press enter to keep the current choice[*], or type selection number: 1
update-alternatives: using /mnt/glusterfs/programs/jdk1.8.0_05/bin/java to provide /usr/bin/java (java) in manual mode
root@client:/home/auser/Desktop/OpenLDAP# update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   1061      auto mode
* 1            /mnt/glusterfs/programs/jdk1.8.0_05/bin/java     1041      manual mode
  2            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   1061      manual mode
  3            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1051      manual mode

Press enter to keep the current choice[*], or type selection number:

# check the version of java in local system

root@client:~/local_installations# java -version
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)






posted by citadel