本文大部分内容源自参考文献1。
1.使用Maven3.1.1的时候出现了很多错误,果断放弃。
我选择环境如下:
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 21:51:28+0800)
Maven home: /home/hadoop/apache-maven-3.0.5
java version "1.6.0_27"
OpenJDK Runtime Environment (IcedTea6 1.12.6) (6b27-1.12.6-1ubuntu0.12.04.4)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
Java home: /usr/bin/
2. 最新的2.2.0 的Source Code 压缩包解压出来的code有个bug 需要patch后才能编译。否则编译hadoop-auth 会提示下面错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:testCompile (default-testCompile) on project hadoop-auth: Compilation failure: Compilation failure: [ERROR] /home/chuan/trunk/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java:[84,13] cannot access org.mortbay.component.AbstractLifeCycle [ERROR] class file for org.mortbay.component.AbstractLifeCycle not found
Patch :https://issues.apache.org/jira/browse/HADOOP-10110
3.安装所需软件
1)安装findbugs
mmicky@wyy:/app$ sudo tar zxf /home/mmicky/Soft/hadoop/findbugs-2.0.2.tar.gz
mmicky@wyy:/app$ sudo mv findbugs-2.0.2 findbugs202
mmicky@wyy:/app$ vi ~/.bashrc
增加两行:
export FINDBUGS_HOME=/app/findbugs202
export PATH=${FINDBUGS_HOME}/bin:$PATH
mmicky@wyy:/app$ source ~/.bashrc
注意:必须是设置为FINDBUGS_HOME,在编译的时候会引用${FINDBUGS_HOME}变量
2)安装依赖库
sudo apt-get install libssl-dev
sudo apt-get install liblzo2-dev
sudo apt-get install libncurses5-dev
3)cmake,protobuf-2.5.0
4. build hadoop 包:
mvn package -DskipTests -Pdist,native,docs -Dtar
参考文献:
1. CentOS编译Hadoop 2.2.0 Pass 总结http://blog.csdn.net/zwj0403/article/details/16855555