天天看點

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)

繼續閱讀