编译Hadoop2.5.2-64位所需要的工具包:apache-ant-1.9.5-bin.tar.gzapache-maven-3.2.5-bin.tar.gzprotobuf-2.5.0.tar.gzjdk-7u79-linux-x64.gzhadoop-2.5.2-src.tar.gz编译Hadoop2.5.2的步骤:编译前请准备以上所有的压缩包,保证网络畅通,一些什么教育网啦,长城宽带啦要稍微的吃点苦头了!OK,废话不多说,开始编译的过程:1、配置JDK的环境变量:解压 jdk-7u79-linux-x64.gz 用MV命令移动到 /usr/java目录下,配置环境变量(/etc/profile)内容如下:JAVA_HOME=/usr/java/jdk1.7.0_79
JRE_HOME=/usr/java/jdk1.7.0_79/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
export JAVA_HOME JRE_HOME PATH CLASSPATH配置好后输入命令:[root@code1 ~]# source /etc/profile
[root@code1 ~]# java -versionjava version “1.7.0_79″Java(TM) SE Runtime Environment (build 1.7.0_79-b15)Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)查看是否配置成功。2、配置maven的环境变量:解压apache-maven-3.2.5-bin.tar.gz,MV命令移动到/usr/maven目录下,配置环境变量:M2_HOME=/usr/maven/apache-maven-3.2.5
PATH=$PATH:$M2_HOME/bin
export M2_HOME PATH[root@code1 ~]# source /etc/profile
[root@code1 ~]# mvn -versionApache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-15T01:29:23+08:00)Maven home: /usr/maven/apache-maven-3.2.5Java version: 1.7.0_79, vendor: Oracle CorporationJava home: /usr/java/jdk1.7.0_79/jreDefault locale: en_US, platform encoding: UTF-8OS name: “linux”, version: “2.6.32-431.el6.x86_64″, arch: “amd64″, family: “unix” 显示这样的话就成功了3、配置ANT环境变量:解压apache-ant-1.9.5-bin.tar.gz,MV命令移动到 /usr/ant目录下,配置环境变量:ANT_HOME=/usr/ant/apache-ant-1.9.5
PATH=$PATH:$ANT_HOME/bin[root@code1 ~]# source /etc/profile
[root@code1 ~]# ant -versionApache Ant(TM) version 1.9.5 compiled on May 31 2015OK,以上环境变量配置完毕后的样子:JAVA_HOME=/usr/java/jdk1.7.0_79
JRE_HOME=/usr/java/jdk1.7.0_79/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
export JAVA_HOME JRE_HOME PATH CLASSPATH
M2_HOME=/usr/maven/apache-maven-3.2.5
PATH=$PATH:$M2_HOME/bin
export M2_HOME PATH
ANT_HOME=/usr/ant/apache-ant-1.9.5
PATH=$PATH:$ANT_HOME/bin4、安装编译工具:yum groupinstall "Development Tools"yum install cmake
yum install openssl-devel
yum install ncurses-devel5、安装protobuf解压protobuf,后进入protobuf-2.5.0目录执行:./configrue检查通过后进行编译并且安装:make && make install安装成功后执行:[root@code1 ~]# protoc --version
libprotoc 2.5.0证明安装成功6、编译Hadoop2.5.2先解压hadoop-2.5.2-src.tar.gz,进入hadoop-2.5.2-srcmore BUILDING.txt 有编译命令,但是官方的编译命令可能会出错,所以我执行下面的命令:[root@code1 hadoop-2.5.2-src]# mvn clean package -Pdist -Pnative -DskipTests -DtarOK,泡杯茶开始喝吧,顺便可以复制一个SSH,使用top命令监控一下,整个过程就是下载各种文件,目测了下大部分都是apache的,大概持续30分钟左右,出现以下内容:[INFO] Apache Hadoop Main …………………………… SUCCESS [02:02 min][INFO] Apache Hadoop Project POM …………………….. SUCCESS [ 42.057 s][INFO] Apache Hadoop Annotations …………………….. SUCCESS [ 28.132 s][INFO] Apache Hadoop Assemblies ……………………… SUCCESS [ 0.878 s][INFO] Apache Hadoop Project Dist POM ………………… SUCCESS [ 26.895 s][INFO] Apache Hadoop Maven Plugins …………………… SUCCESS [ 51.382 s][INFO] Apache Hadoop MiniKDC ………………………… SUCCESS [02:27 min][INFO] Apache Hadoop Auth …………………………… SUCCESS [ 32.678 s][INFO] Apache Hadoop Auth Examples …………………… SUCCESS [ 16.727 s][INFO] Apache Hadoop Common …………………………. SUCCESS [04:58 min][INFO] Apache Hadoop NFS ……………………………. SUCCESS [ 12.835 s][INFO] Apache Hadoop Common Project ………………….. SUCCESS [ 0.151 s][INFO] Apache Hadoop HDFS …………………………… SUCCESS [05:39 min][INFO] Apache Hadoop HttpFS …………………………. SUCCESS [ 39.693 s][INFO] Apache Hadoop HDFS BookKeeper Journal ………….. SUCCESS [ 37.543 s][INFO] Apache Hadoop HDFS-NFS ……………………….. SUCCESS [ 7.768 s][INFO] Apache Hadoop HDFS Project ……………………. SUCCESS [ 0.065 s][INFO] hadoop-yarn …………………………………. SUCCESS [ 0.088 s][INFO] hadoop-yarn-api ……………………………… SUCCESS [01:54 min][INFO] hadoop-yarn-common …………………………… SUCCESS [01:26 min][INFO] hadoop-yarn-server …………………………… SUCCESS [ 0.040 s][INFO] hadoop-yarn-server-common …………………….. SUCCESS [ 29.332 s][INFO] hadoop-yarn-server-nodemanager ………………… SUCCESS [01:02 min][INFO] hadoop-yarn-server-web-proxy ………………….. SUCCESS [ 6.084 s][INFO] hadoop-yarn-server-applicationhistoryservice ……. SUCCESS [ 11.786 s][INFO] hadoop-yarn-server-resourcemanager …………….. SUCCESS [ 33.509 s][INFO] hadoop-yarn-server-tests ……………………… SUCCESS [ 1.035 s][INFO] hadoop-yarn-client …………………………… SUCCESS [ 11.079 s][INFO] hadoop-yarn-applications ……………………… SUCCESS [ 0.068 s][INFO] hadoop-yarn-applications-distributedshell ………. SUCCESS [ 5.298 s][INFO] hadoop-yarn-applications-unmanaged-am-launcher ….. SUCCESS [ 4.641 s][INFO] hadoop-yarn-site …………………………….. SUCCESS [ 0.147 s][INFO] hadoop-yarn-project ………………………….. SUCCESS [ 13.383 s][INFO] hadoop-mapreduce-client ………………………. SUCCESS [ 0.087 s][INFO] hadoop-mapreduce-client-core ………………….. SUCCESS [ 45.839 s][INFO] hadoop-mapreduce-client-common ………………… SUCCESS [ 40.054 s][INFO] hadoop-mapreduce-client-shuffle ……………….. SUCCESS [ 8.444 s][INFO] hadoop-mapreduce-client-app …………………… SUCCESS [ 19.536 s][INFO] hadoop-mapreduce-client-hs ……………………. SUCCESS [ 17.029 s][INFO] hadoop-mapreduce-client-jobclient ……………… SUCCESS [ 16.375 s][INFO] hadoop-mapreduce-client-hs-plugins …………….. SUCCESS [ 3.338 s][INFO] Apache Hadoop MapReduce Examples ………………. SUCCESS [ 12.791 s][INFO] hadoop-mapreduce …………………………….. SUCCESS [ 6.546 s][INFO] Apache Hadoop MapReduce Streaming ……………… SUCCESS [ 13.658 s][INFO] Apache Hadoop Distributed Copy ………………… SUCCESS [ 44.031 s][INFO] Apache Hadoop Archives ……………………….. SUCCESS [ 4.282 s][INFO] Apache Hadoop Rumen ………………………….. SUCCESS [ 11.596 s][INFO] Apache Hadoop Gridmix ………………………… SUCCESS [ 9.076 s][INFO] Apache Hadoop Data Join ………………………. SUCCESS [ 11.305 s][INFO] Apache Hadoop Extras …………………………. SUCCESS [ 5.396 s][INFO] Apache Hadoop Pipes ………………………….. SUCCESS [ 11.972 s][INFO] Apache Hadoop OpenStack support ……………….. SUCCESS [ 9.220 s][INFO] Apache Hadoop Client …………………………. SUCCESS [ 9.897 s][INFO] Apache Hadoop Mini-Cluster ……………………. SUCCESS [ 0.111 s][INFO] Apache Hadoop Scheduler Load Simulator …………. SUCCESS [ 17.222 s][INFO] Apache Hadoop Tools Dist ……………………… SUCCESS [ 7.959 s][INFO] Apache Hadoop Tools ………………………….. SUCCESS [ 0.031 s][INFO] Apache Hadoop Distribution ……………………. SUCCESS [ 50.567 s][INFO] ————————————————————————[INFO] BUILD SUCCESS[INFO] ————————————————————————[INFO] Total time: 33:36 min[INFO] Finished at: 2015-05-28T12:46:54+08:00[INFO] Final Memory: 174M/504M[INFO] ————————————————————————恭喜啦,编译成功!enjoy it!在这里说明下,本次编译环境是centos6.5 64位系统,内存4G,网速的话最快7M/s,还行吧!JDK使用1.7_79,非常不推荐使用JDK1.8,Hadoop对1.8的支持并不太好!OK,整个过程一次性成功,在编译时一定要检测各种配置文件,以上的工具包我会打包放在百度网盘,当然也可自行下载。如果该教程帮到你了,留言Say一下呗~未经允许不得转载:李阳博客»Centos6.5编译Hadoop2.5.2-64位