1.安装依赖的包:
yum install gcc-c++ g++ autoconf automake libtool cmake zlib1g-dev pkg-config libssl-dev
2. 安装protobuf 2.5.0,
首先去google的网站上下载protobuf源代码,解压并切换到root用户执行如下命令:
./configure
如果中间发生错误,说明有些依赖包并为安装,
an error occured because dependency is not met
the error is cleaned
把所须依赖都安装好之后,执行:
./make
./make install
3.编译Hadoop源代码
首先下载hadoop-2.2.0的源代码,解压。
2.1. 切换到源代码目录,执行:
mvn install -DskipTests -Dhttp.proxyHost=proxy01.cd.intel.com -Dhttp.proxyPort=
黄色部分作用为设置代理。由于本人的编译环境在公司内网,所以需要设置代理
发现如下错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.:testCompile (default-testCompile) on project hadoop-auth: Compilation failure: Compilation failure:
[ERROR] /home/hduser/hadoop-2.2.-src/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java:[,] error: cannot access AbstractLifeCycle
[ERROR] class file for org.mortbay.component.AbstractLifeCycle not found
[ERROR] /home/hduser/hadoop-2.2.-src/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java:[,] error: cannot access LifeCycle
[ERROR] class file for org.mortbay.component.LifeCycle not found
[ERROR] /home/hduser/hadoop-2.2.-src/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java:[,] error: cannot find symbol
[ERROR] symbol: method start()
[ERROR] location: variable server of type Server
[ERROR] /home/hduser/hadoop-2.2.-src/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java:[,] error: cannot find symbol
[ERROR] -> [Help ]
需要修改源码下边的hadoop-common-project/hadoop-auth/pom.xml,黄色部分为新增代码
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-util</artifactId>
<scope>test</scope>
</dependency>
重新执行,顺利通过
2.2. 生成eclipse项目环境:
mvn eclipse:eclipse -DskipTests -Dhttp.proxyHost=proxy01.cd.intel.com -Dhttp.proxyPort=
2.3. 打开eclipse,导入源代码目录下的项目.