之前看到过很多人讲解源码编译,但自己一直没有尝试过。最近由于工作需要,想在本地搭建一个hadoop阅读环境,学习一下hadoop源码。
准备阶段
(1)首先下载要编译的hadoop源码版本,镜像链接如下:
http://mirror.bit.edu.cn/apache/hadoop/common/
(2)进入到hadoop目录,查看BUILDING.txt,了解编译需要的环境要求:
比如本人编译的hadoop-3.0.2-src:
Requirements:
* Unix System
* JDK 1.8
* Maven 3.3 or later
* ProtocolBuffer 2.5.0
* CMake 3.1 or newer (if compiling native code)
* 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)
* pyth