编译hadoop2.4

摘自 http://www.aboutyun.com/thread-8130-1-1.html、http://www.dataguru.cn/forum.php?mod=viewthread&tid=189176
</pre><p><span style="font-size:18px; word-wrap:break-word; color:rgb(68,68,68); font-family:Tahoma,'Microsoft Yahei',Simsun"><span style="word-wrap:break-word; font-weight:700">一、首先下载hadoop源码包</span></span></p><span style="color:rgb(68,68,68); font-family:Tahoma,'Microsoft Yahei',Simsun; font-size:14px; line-height:21px">下载的方式还是比较多的</span><br style="word-wrap:break-word; color:rgb(68,68,68); font-family:Tahoma,'Microsoft Yahei',Simsun; font-size:14px; line-height:21px" /><span style="font-size:12px; word-wrap:break-word; color:rgb(68,68,68); font-family:Tahoma,'Microsoft Yahei',Simsun"><span style="word-wrap:break-word; font-weight:700">1.svn的方式</span><br style="word-wrap:break-word" /></span><span style="color:rgb(68,68,68); font-family:Tahoma,'Microsoft Yahei',Simsun; font-size:14px; line-height:21px">svn下载首先需要安装SVN,如果想尝试使用svn,可以参考</span><a target=_blank target="_blank" href="http://www.aboutyun.com/thread-7982-1-1.html" style="word-wrap:break-word; color:rgb(51,102,153); font-family:Tahoma,'Microsoft Yahei',Simsun; font-size:14px; line-height:21px">源码管理、获取网络源码工具:TortoiseSVN使用手册</a><span style="color:rgb(68,68,68); font-family:Tahoma,'Microsoft Yahei',Simsun; font-size:14px; line-height:21px">,hadoop的svn下载地址</span><a target=_blank target="_blank" href="http://svn.apache.org/repos/asf/hadoop/common/branches/branch-2.4.0/" style="word-wrap:break-word; color:rgb(51,102,153); font-family:Tahoma,'Microsoft Yahei',Simsun; font-size:14px; line-height:21px">点此</a><br style="word-wrap:break-word; color:rgb(68,68,68); font-family:Tahoma,'Microsoft Yahei',Simsun; font-size:14px; line-height:21px" /><span style="font-size:12px; word-wrap:break-word; color:rgb(68,68,68); font-family:Tahoma,'Microsoft Yahei',Simsun"><span style="word-wrap:break-word; font-weight:700">2.压缩包的方式</span><br style="word-wrap:break-word" /></span><span style="color:rgb(68,68,68); font-family:Tahoma,'Microsoft Yahei',Simsun; font-size:14px; line-height:21px">这里我们介绍一种压缩包的方式。</span><br style="word-wrap:break-word; color:rgb(68,68,68); font-family:Tahoma,'Microsoft Yahei',Simsun; font-size:14px; line-height:21px" /><span style="color:rgb(68,68,68); font-family:Tahoma,'Microsoft Yahei',Simsun; font-size:14px; line-height:21px">首先我们登录官网:</span><br style="word-wrap:break-word; color:rgb(68,68,68); font-family:Tahoma,'Microsoft Yahei',Simsun; font-size:14px; line-height:21px" /><p><a target=_blank target="_blank" href="http://hadoop.apache.org/" style="word-wrap:break-word; color:rgb(51,102,153); font-family:Tahoma,'Microsoft Yahei',Simsun; font-size:14px; line-height:21px">http://hadoop.apache.org/</a><span style="color:rgb(68,68,68); font-family:Tahoma,'Microsoft Yahei',Simsun; font-size:14px; line-height:21px">,我们找到下面链接,点进去下载即可。如果刚接触,不知道怎么下载,可以查看帖子</span><a target=_blank target="_blank" href="http://www.aboutyun.com/thread-7648-1-1.html" style="word-wrap:break-word; color:rgb(51,102,153); font-family:Tahoma,'Microsoft Yahei',Simsun; font-size:14px; line-height:21px">新手指导:hadoop官网介绍及如何下载hadoop(2.4)各个版本与查看hadoop API介绍</a><span style="color:rgb(68,68,68); font-family:Tahoma,'Microsoft Yahei',Simsun; font-size:14px; line-height:21px">,里面介绍的很详细。</span></p><p><span style="color:rgb(68,68,68); font-family:Tahoma,'Microsoft Yahei',Simsun; font-size:14px; line-height:21px"><span style="word-wrap:break-word; font-weight:700; color:rgb(68,68,68); font-family:Tahoma,'Microsoft Yahei',Simsun; font-size:18px; line-height:27px">二、解压</span></span></p><p><span style="color:rgb(68,68,68); font-family:Tahoma,'Microsoft Yahei',Simsun; line-height:21px"><span style="word-wrap:break-word; color:rgb(68,68,68); font-family:Tahoma,'Microsoft Yahei',Simsun; line-height:27px"></span></span></p><pre code_snippet_id="411193" snippet_file_name="blog_20140630_2_3347926" name="code" class="html">tar zxvf hadoop-2.4.0-src.tar.gz
三、解压完毕,我们开始准备编译所需要的软件
这里软件的准备,很多文章写的都不全,这里整理一下。哪些软件是需要安装的。这里需要说明的是有的Linux有自带的这些工具,这个需要仔细看一下版本是否匹配,不匹配则升级一下,有些不能升级,那么就重装一下吧


1、jdk的安装
步骤下载压缩包、解压、配置环境变量 JDK需要下载1.7版本,1.8版本问题较多

tar zxvf jdk-7u51-linux-x64.tar.gz

配置环境变量: (etc/profile)

/usr/jdk1.7/bin

检验是否安装成功

java -version

2、maven的安装

下载3.2.2版本  http://maven.apache.org/download.cgi

解压,拷贝到 /usr/local目录中,并配置环境变量(etc/profile)

检验是否安装成功

mvn -version

3.protobuf的安装

下载https://code.google.com/p/protobuf/,解压到 /usr/local

然后进入protobuf-2.5.0文件夹,进行如下操作:

$ sudo ./configure 
$ sudo make 
$ sudo make check 
$ sudo make install 
$ sudo ldconfig 
注:如执行 configure报错,请检查是否为缺乏gcc编译环境造成,需安装

yum install gcc-c++
安装成功后,重新执行make语句,完成后进行验证

protoc --version   (注:有两个-符号)

4.安装openssl库

yum install openssl-devel
需要安装开发版本

5.CMake安装

sudo yum install cmake
5.zlib安装
yum install zlib-devel
6.ant安装
在http://ant.apache.org/bindownload.cgi下载文件,解压,并拷贝到/usr/local下,在/etc/profile增加环境变量

ant -version
检验安装是否正确。

四、编译hadoop2.4
上面准备工作已经做的差不多了,我们终于可以开始,记得进入src文件夹下,输入下面命令

mvn package -Pdist,native -DskipTests -Dtar 

在目录~/hadoop-2.4.0-src/hadoop-dist/target下有文件:
hadoop-2.4.0.tar.gz

posted on 2014-06-30 10:19  qpanda  阅读(170)  评论(0编辑  收藏  举报