1、下载安装jdk
下载jdk1.6.0_39_x64.bin
./jdk1.6.0_39_x64.bin 执行文件
2、配置环境变量
vim /etc/profile
追加:
export JAVA_HOME=/root/hadoop/jdk1.6.0_39
export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=$PATH:$JAVA_HOME/bin
让环境变量生效
source /etc/profile
java -version 查看jdk版本
3、下载hadoop安装包
wget http://mirror.bit.edu.cn/apache/hadoop/common/stable2/hadoop-2.6.0.tar.gz
解压:
tar -zxvf hadoop-2.6.0.tar.gz
4、 mkdir input 在/root/hadoop下创建input目录
新建文本文件
5、在/root/hadoop/hadoop-2.6.0目录下执行
bin
[[email protected] hadoop-2.6.0]# bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.6.0.jar wordcount /root/hadoop/input /root/hadoop/output
/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.6.0.jar wordcount /root/hadoop/input /root/hadoop/output
[[email protected] hadoop-2.6.0]# bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.6.0.jar wordcount /root/hadoop/input /root/hadoop/output
[[email protected] hadoop-2.6.0]# cat ../input/* hello hello lou lou lou nihao nihao loulou [[email protected] hadoop-2.6.0]# cat ../output/* hello 2 lou 3 loulou 1 nihao 2
6、单机模式搭建成功