CentOS编译Hadoop 2.2.0 Pass 总结
1. 不要使用最新的 Maven3.1.1,与Maven3.0.x存在兼容性问题,所以老是出现java.lang.NoClassDefFoundError: org/sonatype/aether/graph/DependencyFilter之类的错误。
我选择环境如下:
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 21:51:28+0800)
Maven home: /app/Hadoop/apache-maven-3.0.5
Java version: 1.7.0_45, vendor: Oracle Corporation
Java home: /app/hadoop/jdk1.7.0_45/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-358.23.2.el6.x86_64", arch: "amd64", family: "unix"
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. 安装下面安装包:
lzo-devel zlib-devel gcc autoconf automake libtool ncurses-devel openssl-devel
4. 安装下面程序
Ant Maven ProtocolBuffer findbugs CMake
5. /etc/profile 修改如下:
export JAVA_HOME=/app/hadoop/jdk1.7.0_45
export CLASSPATH=.:${JAVA_HOME}/lib/:${JAVA_HOME}/jre/lib/
export ANT_HOME=/app/hadoop/apache-ant-1.9.2
export MAVEN_HOME=/app/hadoop/apache-maven-3.0.5
export FINDBUGS_HOME=/app/hadoop/findbugs-2.0.3-rc1
export PATH=${JAVA_HOME}/bin:${JAVA_HOME}/jre/bin:${ANT_HOME}/bin:${MAVEN_HOME}/bin:${FINDBUGS_HOME}/bin:$PATH
5. build hadoop 包:
mvn package -DskipTests -Pdist,native,docs -Dtar
相关阅读: