1 创建hadoop用户
2 下载jdk和hadoop安装包
3 在root用户下解压jdk到/usr/java
4 配置JAVA_HOME
编辑/etc/profile,在文件最后添加
# set java environment
export JAVA_HOME=/usr/java/jdk1.8.0_191/
export JRE_HOME=/usr/java/jdk1.8.0_191/jre
export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib:$JRE_HOME/lib
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
5 在hadoop用户下解压hadoop安装包到,/usr/hadoop/
6 配置hadoop
编辑 hadoop-env.sh文件,修改JAVA_HOME
export JAVA_HOME=/usr/java/jdk1.8.0_191/
编辑core-site.xml
<configuration> <property> <name>hadoop.tmp.dir</name> <value>/usr/hadoop/tmp</value> <description>A base for other temporary directories.</description> </property> <!-- file system properties --> <property> <name>fs.default.name</name> <value>hdfs://192.168.31.101:9000</value> </property> </configuration>
编辑hdfs-site.xml
<configuration>
<property>
<name>dfs.name.dir</name>
<value>/usr/hadoop/name</value>
<description>namenode上存储hdfs名字空间元数据 </description>
</property>
<property>
<name>dfs.data.dir</name>
<value>/usr/hadoop/data</value>
<description>datanode上数据块的物理存储位置</description>
</property>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>
编辑mapred-site.xml
<configuration> <property> <name>mapred.job.tracker</name> <value>http://192.168.31.101:9001</value> </property> </configuration>
7 格式化存储
hadoop namenode -format
8 启动hadoop
./sbin/start-all.sh
9关闭防火墙
systemctl stop firewalld