hadoop2.9.x源码编译
1.准备如下:
* Unix System
* JDK 1.8+
* 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)
* Linux FUSE (Filesystem in Userspace) version 2.6 or above (if compiling fuse_dfs)
* Internet connection for first build (to fetch all Maven and Hadoop dependencies)
* python (for releasedocs)
* bats (for shell code testing)
* Node.js / bower / Ember-cli (for YARN UI v2 building)
2.安装软件jdk1.8请参考:
http://blog.csdn.net/rchm8519/article/details/48721913
工具包地址下载:
编译源码工具包地址
3.安装库(用于编译源码库)
a.yum -y install svn ncurses-devel gcc*
b.yum -y install lzo-devel zlib-devel autoconf automake libtool cmake openssl-devel
4.安装maven
a. tar zxvf maven压缩包
b. vi /etc/profile 追加
export MAVEN_HOME=/home/apache-maven-3.5.2 #此路径为maven安装路径
export MAVEN_OPTS="-Xms256m -Xmx512m"
export PATH=$PATH:$MAVEN_HOME/bin
c. source /etc/profile 环境变量生效
d.mvn -v经验是否安装成功,成功会显示maven信息,not command则表示安装不成功
5.
安装protocolBuffer
a.tar zxvf protobuf-2.5.0.tar.gz解压缩
b. ./configure
c.make
d.make install
e.protoc --version 检验是否成功
6.
安装findbugs
a.tar zxvf findbugs安装包
b. vi /etc/profile 追加
export FINDBUGS_HOME=/home/findbugs-3.0.0 #findbugs安装路径
export PATH=$PATH:$FINDBUGS_HOME/bin
c. source /etc/profile 环境变量生效
d.
findbugs -version经验是否安装成功,成功会显示maven信息,not command则表示安装不成功
7.开始编译
1.解压tar zxvf hadoop源码包
2.cd hadoop源码包目录
3.执行mvn package -Pdist,native -DskipTests -Dtar或者mvn package -Pdist,native,docs,src -DskipTests -Dtar
4.
编译好的文件在../hadoop-dist/target/hadoop-2.7.1.tar.gz下