[root@kb135 software]# tar -zxvf hadoop-3.1.3.tar.gz -C /opt/module/
[root@kb135 module]# chown -R root:root ./hadoop-3.1.3/
[root@kb135 module]# vim /etc/profile
# HADOOP_HOME
export HADOOP_HOME=/opt/soft/hadoop313
export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$HADOOP_HOME/lib
export HDFS_NAMENODE_USER=root
export HDFS_DATANODE_USER=root
export HDFS_SECONDARYNAMENODE_USER=root
export HDFS_JOURNALNODE_USER=root
export HDFS_ZKFC_USER=root
export YARN_RESOURCEMANAGER_USER=root
export YARN_NODEMANAGER_USER=root
export HADOOP_MAPRED_HOME=$HADOOP_HOME
export HADOOP_COMMON_HOME=$HADOOP_HOME
export HADOOP_HDFS_HOME=$HADOOP_HOME
export HADOOP_YARN_HOME=$HADOOP_HOME
export HADOOP_INSTALL=$HADOOP_HOME
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
export HADOOP_LIBEXEC_DIR=$HADOOP_HOME/libexec
export JAVA_LIBRARY_PATH=$HADOOP_HOME/lib/native
export HADOOP_CONF_DIR=$HADOOP_HOME/etc/hadoop
修改完之后[root@kb135 module]# source /etc/profile
[root@kb135 module]# cd ./hadoop-3.1.3/
创建目录data
[root@kb135 hadoop-3.1.3]# mkdir ./data
进入/opt/module/hadoop-3.1.3/etc/hadoop目录,查看目录下的文件,配置几个必要的文件
[root@kb135 hadoop]# vim ./core-site.xml
[root@kb135 hadoop]# vim ./hadoop-env.sh
修改第54行
export JAVA_HOME=/opt/module/jdk1.8.0_381
[root@kb135 hadoop]# vim ./hdfs-site.xml
[root@kb135 hadoop]# vim ./mapred-site.xml
[root@kb135 hadoop]# vim ./yarn-site.xml
[root@kb135 hadoop]# vim ./workers
修改为kb135
进入/opt/module/hadoop-3.1.3/bin路径
[root@kb135 bin]# hadoop namenode -format
[root@kb135 ~]# ssh-keygen -t rsa -P ""
[root@kb135 ~]# cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
[root@kb135 ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub -p22 root@kb135
[root@kb135 ~]# start-all.sh
查看进程
[root@kb135 ~]# jps
网页中输入网址:http://192.168.142.135:9870/