下载hadoop安装包解压
    编辑hadoop/etc/hadoop/下文件
    编辑hadoop-env.sh文件,设置java环境变量

    1. export JAVA_HOME=/opt/jdk1.8.0_211

    编辑core-site.xml文件

    1. <configuration>
    2. <property>
    3. <name>hadoop.tmp.dir</name>
    4. <value>file:/opt/hadoop-2.10.1/tmp</value>
    5. <description>Abase for other temporary directories.</description>
    6. </property>
    7. <property>
    8. <name>fs.defaultFS</name>
    9. <value>hdfs://localhost:9000</value>
    10. </property>
    11. <property>
    12. <name>hadoop.proxyuser.root.hosts</name>
    13. <value>*</value>
    14. </property>
    15. <property>
    16. <name>hadoop.proxyuser.root.groups</name>
    17. <value>*</value>
    18. </property>
    19. </configuration>

    编辑hdfs-site.xml文件

    1. <configuration>
    2. <property>
    3. <name>dfs.replication</name>
    4. <value>1</value>
    5. </property>
    6. <property>
    7. <name>dfs.namenode.name.dir</name>
    8. <value>file:/opt/hadoop-2.10.1/tmp/dfs/name</value>
    9. </property>
    10. <property>
    11. <name>dfs.datanode.data.dir</name>
    12. <value>file:/opt/hadoop-2.10.1/tmp/dfs/data</value>
    13. </property>
    14. <property>
    15. <name>hadoop.http.staticuser.user</name>
    16. <value>root</value>
    17. </property>
    18. <property>
    19. <name>dfs.permissions.enabled</name>
    20. <value>false</value>
    21. </property>
    22. </configuration>

    执行名称节点格式化
    修改配置文件以后,要执行名称节点的格式化,命令如下:

    1. ./bin/hdfs namenode -format

    启动Hadoop all

    1. ./sbin/start-all.sh

    配置hadoop环境变量

    1. export HADOOP_HOME=/opt/hadoop-2.10.1
    2. export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HAME/sbin