码迷,mamicode.com
首页 > 其他好文 > 详细

hadoop2.4源码编译

时间:2014-10-05 12:08:58      阅读:306      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   io   os   ar   java   for   

Linux环境下编译hadoop2.4

 

1、jdk的安装

     ...

   检验是否安装成功 java -version、java、javac

2、maven的安装

    ...

    验证安装是否成功   mvn -version

3、protobuf的安装

(0) 安装gcc

#方法一:
sudo apt-get  build-depgcc

#方法二:
sudo apt-get  install  build-essential

#验证安装:
gcc --version

 

(1)下载
  1. sudo wget https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.gz

 (2)安装:

然后进入protobuf-2.5.0文件夹,进行如下操作: 
$ sudo ./configure
$ sudo make
$ sudo make check
$ sudo make install
$ sudo ldconfig

(3)验证

protoc --version

 bubuko.com,布布扣

4.安装openssl库

  1. sudo apt-get install libssl-dev

5.CMake安装

 

  1. sudo apt-get install cmake

6.ant安装

(1)首先下载ant

(2)解压

  1. tar zxvf apache-ant-1.9.4-bin.tar.gz

 (3)配置环境变量

bubuko.com,布布扣

source /etc/profile

(4).检验安装成功

  1. ant -version

bubuko.com,布布扣

二、编译hadoop2.4

上面准备工作已经做的差不多了,进入hadoop-src/文件夹下,输入下面命令
mvn package -Pdist,native -DskipTests -Dtar

 

等了40多分钟,ok

bubuko.com,布布扣

 

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

bubuko.com,布布扣

 

问题总结:

这里还需要在补充:
1.遇到错误1:CMake没有安装
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-
plugin:1.6:run (make) on project hadoop-common: An Ant BuildException has
occured: Execute failed: java.io.IOException: Cannot run program "cmake" (in
directory "/home/wyf/hadoop-2.0.2-alpha-src/hadoop-common-project/hadoop-
common/target/native"): java.io.IOException: error=2, No such file or directory
-> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please
read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

 

解决方法:

CMake没有安装

 

  1. sudo apt-get install cmake

2.遇到错误2:ant没有安装

ERROR] Failed to execute goal org.codehaus.mojo.jspc:jspc-maven-plugin:2.0-
alpha-3:compile (hdfs) on project hadoop-hdfs: Execution hdfs of goal
org.codehaus.mojo.jspc:jspc-maven-plugin:2.0-alpha-3:compile failed: Plugin
org.codehaus.mojo.jspc:jspc-maven-plugin:2.0-alpha-3 or one of its dependencies
could not be resolved: Could not transfer artifact ant:ant:jar:1.6.5 from/to
central (http://repo.maven.apache.org/maven2): GET request of:
ant/ant/1.6.5/ant-1.6.5.jar from central failed: Read timed out -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please
read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :hadoop-hdfs

 

解决:

   安装ant。

3.protobuf版本过低,错误现象

[ERROR] Failed to execute goal org.apache.hadoop:hadoop-maven-plugins:2.4.0:prot
oc (compile-protoc) on project hadoop-common: org.apache.maven.plugin.MojoExecut
ionException: protoc --version did not return a version -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :hadoop-common

bubuko.com,布布扣

hadoop2.4对应的版本是protobuf-2.5.0

解决办法:

     按照安装步骤中protobuf-2.5.0的安装即可

hadoop2.4源码编译

标签:style   blog   http   color   io   os   ar   java   for   

原文地址:http://www.cnblogs.com/muzhongjiang/p/4006743.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!