天天看点

centos 6 环境下用maven编译安装hadoop2.7.2源码包

  案例描述:

        虚拟机安装32位centos系统,下载了最新版的hadoop2.7.2 免安装包,发现无法运行,因为其中的lib/native目录下的lib.so文件默认为64位的,因此,只能通过重新编译源码包的方式进行安装。按照Build.txt 文档中的要求,安装以下依赖:

* Unix System

* JDK 1.7+

* Maven 3.0 or later

* Findbugs 1.3.9 (if running findbugs)

* ProtocolBuffer 2.5.0

* CMake 2.6 or newer (if compiling native code), must be 3.0 or newer on Mac

* Zlib devel (if compiling native code)

* openssl devel ( if compiling native hadoop-pipes and to get the best HDFS encryption performance )

遇到的问题:

1、安装ProtocolBuffer

       使用yum命令无法自动安装,必须手动下载安装。

2、安装报错

  提示libssl-dev及 zlib1g-dev 缺失

解决方法: 在centos环境中没有libssl-dev l这个包,应该使用以下命令:

yum install openssl-devel 

3、 提示java heap outofMemory

  当模块较多或插件较多的时候,会出现内存不足的情况,唯一的办法就是提高JVM内存。命令如下:

   解决办法:

export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=128m"
https://cwiki.apache.org/confluence/display/MAVEN/OutOfMemoryError
      

4、 编译过程中无法定位错误具体位置

  采用debug 模式编译。-X -e

  解决方法:  mvn package -Pnative,docs,dist -Dtar  -X -e

5、命令

 Build options:

  * Use -Pnative to compile/bundle native code

  * Use -Pdocs to generate & bundle the documentation in the distribution (using -Pdist)

  * Use -Psrc to create a project source TAR.GZ

  * Use -Dtar to create a TAR with the distribution (using -Pdist)

继续阅读