首页 > 代码库 > 编译hadoop
编译hadoop
基于操作系统CentOS 6.4 basic server版,编译hadoop版本2.5.2
1. 下载hadoop源代码包
$ wget http://mirrors.cnnic.cn/apache/hadoop/common/hadoop-2.5.2/hadoop-2.5.2-src.tar.gz
2. 安装工具包
$ sudo yum install lzo-devel zlib-devel gcc autoconf automake libtool ncurses-devel openssl-deve cmake git
3. 安装maven
$ wget http://mirrors.cnnic.cn/apache/maven/maven-3/3.2.5/binaries/apache-maven-3.2.5-bin.tar.gz
export MAVEN_HOME=/home/yimr/build_hadoop/apache-maven-3.2.5
export PATH=$PATH:$MAVEN_HOME/bin
4. 安装ant
$ wget http://mirrors.cnnic.cn/apache//ant/binaries/apache-ant-1.9.4-bin.tar.gz
export ANT_HOME=/home/yimr/build_hadoop/apache-ant-1.9.4
export PATH=$PATH:$ANT_HOME/bin
5. 安装findbugs
$ wget http://prdownloads.sourceforge.net/findbugs/findbugs-noUpdateChecks-3.0.0.tar.gz?download
export FINDBUGS_HOME=/home/yimr/build_hadoop/findbugs-3.0.0
export PATH=$PATH:$FINDBUGS_HOME/bin
6. 安装protobuf(只能是版本2.5.0,不能更高版本或更低版本)
$ wget https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.gz
$ ./configure --prefix=/home/yimr/build_hadoop/protobuf-2.5.0
$ make
$ make install
7. 编译hadoop
$ cd /home/yimr/build_hadoop/hadoop-2.5.2-src
$ mvn package -DskipTests -Pdist,native -Dtar
8. 编译成功
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13:34 min
[INFO] Finished at: 2015-01-12T13:19:34+08:00
[INFO] Final Memory: 147M/524M
[INFO] -------------------------
9. 替换native lib
编译hadoop