1、下载地址
Index of apache-local/hadoop/common
https://repo.huaweicloud.com/apache/hadoop/common/
或者
Index of /dist/hadoop/common/hadoop-3.1.2/
https://archive.apache.org/dist/hadoop/common/hadoop-3.1.2/
2、上传到linux,并解压
tar -zxvf hadoop-3.1.2.tar.gz -C /opt/
3、更改文件名
mv /opt/hadoop-3.1.2 /opt/hadoop
4、执行以下命令,配置Hadoop环境变量 vim /etc/profile
echo ‘export HADOOP_HOME=/opt/hadoop/’ >> /etc/profile
echo ‘export PATH=$PATH:$HADOOP_HOME/bin’ >> /etc/profile
echo ‘export PATH=$PATH:$HADOOP_HOME/sbin’ >> /etc/profile
5、配置生效
source /etc/profile
6、执行以下命令,修改配置文件yarn-env.sh和hadoop-env.sh。
echo “export JAVA_HOME=/usr/local/java/jdk1.8.0_161” >> /opt/hadoop/etc/hadoop/yarn-env.sh
echo “export JAVA_HOME=/usr/local/java/jdk1.8.0_161” >> /opt/hadoop/etc/hadoop/hadoop-env.sh
7、查看版本是否安装成功
hadoop version