useradd –m hadoop –s /bin/bash
passwd hadoop
增加sudo权限
chmod u+w /etc/sudoers
vi /etc/sudoers
root ALL=(ALL) ALL
chmod u-w /etc/sudoers
hadoop ALL=(ALL) ALL
su hadoop && cd ~
wget http://mirror.bit.edu.cn/apache/hadoop/common/hadoop-2.7.7/hadoop-2.7.7.tar.gz
tar -zxf hadoop-2.7.7.tar.gz
sudo mkdir /usr/local/hadoop
sudo mv hadoop-2.7.7 /usr/local/hadoop
mkdir dfs
mkdir dfs/name
mkdir dfs/data
mkdir tmp
cd /usr/local/hadoop/hadoop-2.7.7/etc/hadoop
涉及到的配置文件有7个:
安装路径/hadoop-2.7.7/etc/hadoop/hadoop-env.sh
安装路径/hadoop-2.7.7/etc/hadoop/yarn-env.sh
安装路径/hadoop-2.7.7/etc/hadoop/slaves
安装路径/hadoop-2.7.7/etc/hadoop/core-site.xml
安装路径/hadoop-2.7.7/etc/hadoop/hdfs-site.xml
安装路径/hadoop-2.7.7/etc/hadoop/mapred-site.xml
安装路径/hadoop-2.7.7/etc/hadoop/yarn-site.xml
===
安装路径/hadoop-2.7.7/etc/hadoop/hadoop-env.sh
安装路径/hadoop-2.7.7/etc/hadoop/yarn-env.sh
安装路径/hadoop-2.7.7/etc/hadoop/slaves
安装路径/hadoop-2.7.7/etc/hadoop/core-site.xml
安装路径/hadoop-2.7.7/etc/hadoop/hdfs-site.xml
安装路径/hadoop-2.7.7/etc/hadoop/mapred-site.xml
安装路径/hadoop-2.7.7/etc/hadoop/yarn-site.xml
===
cat core-site.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://localhost:8020</value>
</property>
<property>
<name>io.file.buffer.size</name>
<value>131072</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>file:/home/hadoop/tmp</value>
<description>Abase for other temporary directories.</description>
</property>
<property>
<name>hadoop.proxyuser.hadoop.hosts</name>
<value>*</value>
</property>
<property>
<name>hadoop.proxyuser.hadoop.groups</name>
<value>*</value>
</property>
</configuration>
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://localhost:8020</value>
</property>
<property>
<name>io.file.buffer.size</name>
<value>131072</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>file:/home/hadoop/tmp</value>
<description>Abase for other temporary directories.</description>
</property>
<property>
<name>hadoop.proxyuser.hadoop.hosts</name>
<value>*</value>
</property>
<property>
<name>hadoop.proxyuser.hadoop.groups</name>
<value>*</value>
</property>
</configuration>
===
cat hdfs-site.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>dfs.namenode.secondary.http-address</name>
<value>localhost:9001</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>file:/home/hadoop/dfs/name</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>file:/home/hadoop/dfs/data</value>
</property>
<property>
<name>dfs.replication</name>
<value>3</value>
</property>
<property>
<name>dfs.webhdfs.enabled</name>
<value>true</value>
</property>
</configuration>
===
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>dfs.namenode.secondary.http-address</name>
<value>localhost:9001</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>file:/home/hadoop/dfs/name</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>file:/home/hadoop/dfs/data</value>
</property>
<property>
<name>dfs.replication</name>
<value>3</value>
</property>
<property>
<name>dfs.webhdfs.enabled</name>
<value>true</value>
</property>
</configuration>
===
cp mapred-site.xml.template mapred-site.xml