When I want to install hadoop, hive, R, and RHive, the dependencies is JDK, previously I use embedded java from linux package, but, it doesn’t work well, so I try to install Sun JDK downloaded from Oracle, by using the reference from here
Installing Sun JDK 7 on Ubuntu 12.04
- Download the sun jdk 6 bin from here.
- Make the bin file executeable:
$ chmod +x jdk-6u32-linux-x64.bin
$ ./jdk-6u32-linux-x64.bin
- For Ubuntu 13.04: There is no longer a jvm folder in /usr/lib, therefore create jvm folder
$ sudo mkdir /usr/lib/jvm
- Move extracted folder to this location:
$ sudo mv jdk1.6.0_38 /usr/lib/jvm/jdk1.6.0_38
- Install new java source in system:
$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_38/bin/javac 1
$ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_38/bin/java 1
$ sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_38/bin/javaws 1
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javaws
$ java -version
- Verify the symlinks all point to the new java location:
$ ls -la /etc/alternatives/java*
Installing Sun JDK 7 on Ubuntu 12.04
- Download the sun jdk 7 tar file from here
- Extract the tar file:
$ tar -xvzf jdk-7u11-linux-x64.tar.gz
- For Ubuntu 13.04: There is no longer a jvm folder in /usr/lib, therefore create jvm folder
$ sudo mkdir /usr/lib/jvm
- Move extracted folder to this location:
$ sudo mv jdk1.7.0_11 /usr/lib/jvm/jdk1.7.0_11
- Install new java source in system:
$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_11/bin/javac 1
$ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_11/bin/java 1
$ sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.7.0_11/bin/javaws 1
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javaws
$ java -version
- Verify the symlinks all point to the new java location:
$ ls -la /etc/alternatives/java*
Update JAVA_HOME
JAVA_HOME configuration: Some tools require JAVA_HOME variable. You can set JAVA_HOME in Ubuntu so simple: Edit the file .bashrc under your home directory and add the following lines: (if .bashrc is hidden, click in Nautilus Menu View > Show Hidden Files)
export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_11 or /usr/lib/jvm/jdk1.6.0_45
export PATH=$JAVA_HOME/bin:$PATH
or add this JAVA_HOME=/usr/lib/jvm/jdk1.7.0_11 in /etc/environment with sudo gedit /etc/environment
while installing RHive, if the libjvm.so is missing, I try to add this following line in .bashrc file, and it’s working
export JAVA_HOME=/usr/lib/jvm/jdk1.6.0_45
export LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/amd64/server