这几天刚接触Hadoop,在学习如何搭建一个Hadoop集群。在这分享一下,最新版的 ubuntu12.04 + hadoop1.0.3
hadoop下载 【renren的国内镜像,速度比较快】
http://labs.renren.com/apache-mirror//hadoop/core/
ubuntu12.04(64bit)安装java运行环境
sudo apt-get install openjdk-6-jdk
最终安装位置为 /usr/lib/jvm/java-6-openjdk-amd64 [64位,如果不是64位系统,请进目录查找]
下载hadoop后,解压到/home 目录下
hadoop的目录为 /home/hadoop-1.0.3
修改一下hadoop的目录拥有者(xzy为指定的linux用户账号)
sudo chown xzy:xzy hadoop-1.0.3 -R
cd hadoop-1.0.3
vim conf/hadoop-env.sh
找到下面一行,去除注释,把jdk的路径写上
# export JAVA_HOME=/usr/lib/j2sdk1.5-sun
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64
验证hadoop是否安装成功
bin/hadoop version
Hadoop 1.0.3
Subversion https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1.0 -r 1335192
Compiled by hortonfo on Tue May 8 20:31:25 UTC 2012
From source with checksum e6b0c1e23dcf76907c5fecb4b832f3be
最后一步,运行一个demo任务WordCount
mkdir input
cp conf/* input
bin/hadoop jar hadoop-examples-1.0.3.jar wordcount input output
cat output/*