环境要求:java、ssh
1.上传并解压tar包
[root@hadoop000 software]# rz #上传hadoop-2.8.1.tar.gz
[root@hadoop000 software]# tar -xzvf hadoop-2.8.1.tar.gz
2.配置环境变量
[root@hadoop000 software]# vi /etc/profile
export HADOOP_HOME=/opt/software/hadoop-2.8.1
export PATH=$HADOOP_HOME/bin:$PROTOC_HOME/bin:$FINDBUGS_HOME/bin:$MAVEN_HOME/bin:$JAVA_HOME/bin:$PATH
[root@hadoop000 software]# source /etc/profile
3.配置文件
[hadoop@hadoop000 ~]# cd /opt/software/hadoop-2.8.1
[hadoop@hadoop000 hadoop-2.8.1]# vi etc/hadoop/core-site.xml
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://192.168.137.130:9000</value> # 配置自己机器的IP
</property>
</configuration>
[hadoop@hadoop000 hadoop-2.8.1]# vi etc/hadoop/hdfs-site.xml
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>
#更改JAVA_HOME
[hadoop@hadoop000 hadoop-2.8.1]# vi etc/hadoop/hadoop-env.sh
# 将export JAVA_HOME=${JAVA_HOME}改为
export JAVA_HOME=/usr/java/jdk1.8.0_45
4.格式化和启动
[hadoop@hadoop000 hadoop-2.8.1]# bin/hdfs namenode -format
[hadoop@hadoop000 hadoop-2.8.1]# sbin/start-dfs.sh
5.检查是否成功
[hadoop@hadoop000 hadoop-2.8.1]# jps
19536 DataNode
19440 NameNode
19876 Jps
19740 SecondaryNameNode
访问: http://localhost:50070