安装HADOOP
首先下载一个tar包在本地。
这里选择放在用户家目录下。
然后解压缩。
[hadoop@localhost ~]$ tar xzf hadoop-2.8.5.tar.gz
配置JAVA_HOME环境:
[hadoop@localhost hadoop-2.8.5]$ whereis java
java: /usr/bin/java /etc/java /usr/lib/java /usr/share/java /usr/share/man/man1/java.1.gz
接下来:/usr/bin/java
[hadoop@localhost hadoop-2.8.5]$ ls -lrt /usr/bin/java
lrwxrwxrwx. 1 root root 22 Oct 24 17:23 /usr/bin/java -> /etc/alternatives/java
接下来:/etc/alternatives/java
[hadoop@localhost hadoop-2.8.5]$ ls -lrt /etc/alternatives/java
lrwxrwxrwx. 1 root root 46 Oct 24 17:23 /etc/alternatives/java -> /usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin/java
得到了我们的java环境路径:/usr/lib/jvm/jre-1.8.0-openjdk.x86_64
配置环境变量:
[hadoop@localhost hadoop-2.8.5]$ export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk.x86_64
[hadoop@localhost hadoop-2.8.5]$ export HADOOP_HOME=~/hadoop-2.8.5
[hadoop@localhost hadoop-2.8.5]$ export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin
编辑hadoop-env.sh文件:
[hadoop@localhost .ssh]$ vi ~/hadoop-2.8.5/etc/hadoop/hadoop-env.sh
更改export JAVA_HOME=${JAVA_HOME}
为export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk.x86_64
判读按Hadoop是否正常工作:
[hadoop@localhost hadoop-2.8.5]$ hadoop version
Hadoop 2.8.5
Subversion https://git-wip-us.apache.org/repos/asf/hadoop.git -r 0b8464d75227fcee2c6e7f2410377b3d53d3d5f8
Compiled by jdu on 2018-09-10T03:32Z
Compiled with protoc 2.5.0
From source with checksum 9942ca5c745417c14e318835f420733
This command was run using /home/hadoop/hadoop-2.8.5/share/hadoop/common/hadoop-common-2.8.5.jar