The installation steps are as follows:
1) Download JDK 8
Choose to download the latest JDK version of JDK 8 from http://www.oracle.com/technetwork/java/javasebusiness/downloads/. I chose to: jdk-8u5-linux-x64.tar.gz This version of the JDK does not need to install, only need to decompress, and then configure the environment variables.
2) Create a new folder#sudo mkdir-p/usr/local/java
3) Copy the downloaded JDK to the directory below.
#sudo Cp/home/hadoop/downloads/jdk-8u5-linux-x64.tar.gz/usr/local/java
4) Unzip the JDK#cd/usr/local/java
#sudo Tar zxvf jdk-8u5-linux-x64.tar.gz
#sudo RM jdk-8u5-linux-x64.tar.gz
#sudo ln-s Jdk1.8.0_05/usr/local/java/latest//To establish a soft link, if you want to update the JDK after the installation, and then update the soft link, do not update the environment variables, so you can be unified management.
5) Configure environment variables#sudo gedit/etc/environment Modify path in environment, append the JDK path, add classpath and Java_home, with the following contents: Java_home= "/usr/local/java/ Latest
Jre_home= "/usr/local/java/latest/jre"
Path= "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/java/latest/bin" Remember to let the environment variable configuration take effect source #source/etc/environment
6) Then tell the system that we're using Sun's jdk, not openjdk# sudo update-alternatives--install/usr/bin/java Java/usr/local/java/jdk1.8.0_05/bin/java 300
# sudo update-alternatives--install/usr/bin/javac javac/usr/local/java/jdk1.8.0_05/bin/javac # sudo update-altern Atives--config Java
7) Test if the installation is successful:# 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) successfully installed! Reference: http://www.myexception.cn/eclipse/1642383.html
Installing the Hadoop series-Installing JDK-8U5