Hadoop2.4.0 重新编译 64 位本地库
环境:虚拟机 VirtualBox,操作系统 64 位 CentOS 6.4
1、jdk环境 (export PATH=$JAVA_HOME/bin:$PATH $PATH放在后面)
#export JAVA_HOME=/opt/jdk1.8.0_141
export JAVA_HOME=/opt/jdk1.7.0_80
export PATH=$JAVA_HOME/bin:$PATH
export JRE_HOME=/opt/jdk1.7.0_80/jre
export CLASSPATH=./:/opt/jdk1.7.0_80/lib:/opt/jdk1.7.0_80/jre/lib
2、下载重新编译需要的软件包
apache-ant-1.9.4-bin.tar.gz
findbugs-3.0.0.tar.gz
protobuf-2.5.0.tar.gz
apache-maven-3.0.5-bin.tar.gz
3、下载 hadoop2.4.0 的源码包
hadoop-2.4.0-src.tar.gz
3.1、压解源码包
[jason@hadoopMaster01 ~]$ tar -zxvf hadoop-2.4.0-src.tar.gz
4、安装编译所需软件
安装 MAVEN
4.1、压解 apache-maven-3.0.5-bin.tar.gz 到/opt/目录
[root@hadoopMaster01 jason]# tar -zxvf apache-maven-3.0.5-bin.tar.gz -C /opt/module
4.2、修改/etc/profile 配置,增加 MAVEN 环境配置
4.3、保存后使用 source /etc/profile 使修改配置即时生效
[root@hadoopMaster01 apache-maven-3.0.5]# source /etc/profile
4.4、使用 mvn -v 命令进行验证,如图所示表示安装配置成功
5、安装 ANT
5.1、压解 apache-ant-1.9.4-bin.tar.gz 到/opt/目录
[root@hadoopMaster01 jason]# tar -zxvf apache-ant-1.9.4-bin.tar.gz -C /opt/module
5.2、修改/etc/profile 配置,增加 ANT 环境配置
export ANT_HOME=/opt/module/apache-ant-1.9.4
export PATH=$PATH:$ANT_HOME/bin
5.3、保存后使用 source /etc/profile 使修改配置即时生效
[root@hadoopMaster01 apache-ant-1.9.4]# source /etc/profile
5.4、使用 ant-version 命令进行验证,如图所示表示安装配置成功
6、安装 FINDBUGS
6.1、压解 findbugs-3.0.0.tar.gz 到/opt/目录
[root@hadoopMaster01 jason]# tar -zxvf findbugs-3.0.0.tar.gz -C /opt/module
6.2、修改/etc/profile 配置,增加 FINDBUGS 环境配置
export FINDBUGS_HOME=/opt/module/findbugs-3.0.0
export PATH=$PATH:$FINDBUGS_HOME/bin
6.3、保存后使用 source /etc/profile 使修改配置即时生效
[root@hadoopMaster01 apache-ant-1.9.4]# source /etc/profile
6.4、使用 findbugs -version 命令进行验证,如图所示表示安装配置成功
7、安装 PROTOBUF
7.1、编译 Hadoop 2.4.0,需要 protobuf 的编译器protoc,一定要是 protobuf 2.5.0 以上
7.2、安装gcc c++ make
yum install -y gcc gcc-c++ make
7.3、直接压解 protobuf-2.5.0.tar.gz
[root@hadoopMaster01 jason]# tar -zxvf protobuf-2.5.0.tar.gz
7.4、安装 protobuf,依次执行如下命令
[root@hadoopMaster01 jason]# cd protobuf-2.5.0
[root@hadoopMaster01 protobuf-2.5.0]# ls
aclocal.m4 config.guess configure COPYING.txt examples
install-sh ltmain.sh Makefile.in protobuf.pc.in src
autogen.sh config.h.in configure.ac depcomp generate_descriptor_proto.sh
INSTALL.txt m4 missing python vsprojects
CHANGES.txt config.sub CONTRIBUTORS.txt editors gtest
java Makefile.am protobuf-lite.pc.in README.txt
[root@hadoopMaster01 protobuf-2.5.0]# ./configure
[root@hadoopMaster01 protobuf-2.5.0]# make
[root@hadoopMaster01 protobuf-2.5.0]# make check
[root@hadoopMaster01 protobuf-2.5.0]# make install
7.5、使用 protoc --version 命令进行验证,如图所示表示安装配置成功
8、安装 依赖包
8.1、安装 cmake,openssl-devel,ncurses-devel 依赖包(root 用户且能够连上互联网)
[root@hadoopMaster01 ~]# yum install cmake
[root@hadoopMaster01 ~]# yum install openssl-devel
[root@hadoopMaster01 ~]# yum install ncurses-devel
编译 64 位本地库
9、进入已压解的 hadoop 源码目录
[jason@hadoopMaster01 ~]$ cd hadoop-2.4.0-src
[jason@hadoopMaster01 hadoop-2.4.0-src]$ pwd
/home/jason/hadoop-2.4.0-src/
9.1、执行 mvn clean install -DskipTests 命令,等待完成(会自动联网下载很多东西)
[jason@hadoopMaster01 hadoop-2.4.0-src]$ mvn clean
[jason@hadoopMaster01 hadoop-2.4.0-src]$ mvn install -DskipTests
9.2、执行 mvn package -Pdist,native -DskipTests -Dtar 命令,开始编译,等待完成
jason@hadoopMaster01 hadoop-2.4.0-src]$ mvn package -Pdist,native -DskipTests -Dtar
出现如下信息
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Apache Hadoop Main ................................ SUCCESS[6.304s]
[INFO] Apache Hadoop Project POM ......................... SUCCESS [26.555s]
[INFO] Apache Hadoop Annotations ......................... SUCCESS[2.757s]
[INFO] Apache Hadoop Assemblies .......................... SUCCESS [0.216s]
[INFO] Apache Hadoop Project Dist POM .................... SUCCESS [19.592s]
[INFO] Apache Hadoop Maven Plugins ....................... SUCCESS [2.715s]
[INFO] Apache Hadoop MiniKDC ............................. SUCCESS [2.360s]
[INFO] Apache Hadoop Auth ................................ SUCCESS [2.950s]
[INFO] Apache Hadoop Auth Examples ....................... SUCCESS[2.119s]
[INFO] Apache Hadoop Common .............................. SUCCESS [1:22.302s]
[INFO] Apache Hadoop NFS ................................. SUCCESS [5.095s]
[INFO] Apache Hadoop Common Project...................... SUCCESS [0.026s]
[INFO] Apache Hadoop HDFS ................................ SUCCESS [2:06.178s]
[INFO] Apache Hadoop HttpFS .............................. SUCCESS [1:09.142s]
[INFO] Apache Hadoop HDFS BookKeeper Journal ............. SUCCESS [14.457s]
[INFO] Apache Hadoop HDFS-NFS ............................SUCCESS [2.859s]
[INFO] Apache Hadoop HDFS Project ........................ SUCCESS [0.030s]
[INFO] hadoop-yarn ....................................... SUCCESS [0.029s]
[INFO] hadoop-yarn-api ................................... SUCCESS [59.010s]
[INFO] hadoop-yarn-common ................................ SUCCESS [20.743s]
[INFO] hadoop-yarn-server ................................ SUCCESS[0.026s]
[INFO] hadoop-yarn-server-common ......................... SUCCESS [7.344s]
[INFO] hadoop-yarn-server-nodemanager .................... SUCCESS [11.726s]
[INFO] hadoop-yarn-server-web-proxy ...................... SUCCESS [2.508s]
[INFO] hadoop-yarn-server-applicationhistoryservice ...... SUCCESS [4.041s]
[INFO] hadoop-yarn-server-resourcemanager ................ SUCCESS [10.370s]
[INFO] hadoop-yarn-server-tests .......................... SUCCESS [0.374s]
[INFO] hadoop-yarn-client ................................ SUCCESS [4.791s]
[INFO] hadoop-yarn-applications .......................... SUCCESS [0.025s]
[INFO] hadoop-yarn-applications-distributedshell ......... SUCCESS [2.242s]
[INFO] hadoop-yarn-applications-unmanaged-am-launcher .... SUCCESS [1.553s]
[INFO] hadoop-yarn-site .................................. SUCCESS [0.024s]
[INFO] hadoop-yarn-project ............................... SUCCESS [3.261s]
[INFO] hadoop-mapreduce-client ........................... SUCCESS [0.082s]
[INFO] hadoop-mapreduce-client-core ...................... SUCCESS [18.549s]
[INFO] hadoop-mapreduce-client-common .................... SUCCESS [13.772s]
[INFO] hadoop-mapreduce-client-shuffle ................... SUCCESS [2.441s]
[INFO] hadoop-mapreduce-client-app ....................... SUCCESS [6.866s]
[INFO] hadoop-mapreduce-client-hs ........................ SUCCESS [6.280s]
[INFO] hadoop-mapreduce-client-jobclient .................SUCCESS [3.510s]
[INFO] hadoop-mapreduce-client-hs-plugins ................ SUCCESS [1.725s]
[INFO] Apache Hadoop MapReduce Examples .................. SUCCESS [4.641s]
[INFO] hadoop-mapreduce .................................. SUCCESS[3.002s]
[INFO] Apache Hadoop MapReduce Streaming ................. SUCCESS [3.497s]
[INFO] Apache Hadoop Distributed Copy .................... SUCCESS [5.847s]
[INFO] Apache Hadoop Archives ............................ SUCCESS [1.791s]
[INFO] Apache Hadoop Rumen ............................... SUCCESS [4.693s]
[INFO] Apache Hadoop Gridmix ............................. SUCCESS [3.235s]
[INFO] Apache Hadoop Data Join........................... SUCCESS [2.349s]
[INFO] Apache Hadoop Extras .............................. SUCCESS [2.488s]
[INFO] Apache Hadoop Pipes ............................... SUCCESS [5.863s]
[INFO] Apache Hadoop OpenStack support ................... SUCCESS [3.776s]
[INFO] Apache Hadoop Client .............................. SUCCESS [5.235s]
[INFO] Apache Hadoop Mini-Cluster ........................ SUCCESS [0.070s]
[INFO] Apache Hadoop Scheduler Load Simulator ............ SUCCESS [3.935s]
[INFO] Apache Hadoop Tools Dist .......................... SUCCESS [4.392s]
[INFO] Apache Hadoop Tools ............................... SUCCESS [0.022s]
[INFO] Apache Hadoop Distribution ........................ SUCCESS [21.274s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10:25.147s
[INFO] Finished at: Mon Jul 28 16:09:56 CST 2014
[INFO] Final Memory: 75M/241M
[INFO] ------------------------------------------------------------------------
表示编译成功
进入/home/jason/hadoop-2.4.0-src/hadoop-dist/target/hadoop-2.4.0/lib/native 检查,使用 file *命令