Install the JDK
We first create a jdk folder, and then copy the downloaded archive to jdk JDK folder {installation package: https://pan.baidu.com/s/1e7aIRRBvw9ujrH74680W7g
extraction code: 9dqm}
then decompressed jdk installation package
tar -zxvf jdk-7u45-linux-x64.tar.gz
Hadoop create a new folder, unzip the file jdk folder to folder hadoop
mv jdk1.7.0_45/ /usr/hadoop1
Configuration environment variable
After unpacking the JDK also you need to configure the environment variable JDK, before you can use, the next step to configure the JDK.
Enter the command: vim /etc/profile
edit the configuration file;
In the end of the file enter the following code (no space):
JAVA_HOME=/usr/hadoop/jdk1.7.0_45 #这里是跟的是jdk安装路径,注意版本号的正确书写
CLASSPATH=.:$JAVA_HOME/lib/tools.jar
PATH=$JAVA_HOME/bin:$PATH
Then, save and exit.
Finally: source /etc/profile
the just configuration to take effect.
Finally, we can test whether the configuration environment variable.
Enter: java -version
the following interface represents the configuration is successful.