最近在搭建Jenkins+Git的CI/CD流程,公司用到了Hadoop的好几个版本,2.6.0、3.2.1、3.3.0,这三个版本对编译环境的要求都有不同,所以以下是我在一台机器搭建三个版本的Hadoop编译环境的过程。
hadoop3.3 Requirements
首先看BUILDING.txt(https://github.com/apache/hadoop/blob/trunk/BUILDING.txt),这里先以3.3版本为准
Requirements:
- Unix System
- JDK 1.8
- Maven 3.3 or later
- Protocol Buffers 3.7.1 (if compiling native code)
- CMake 3.1 or newer (if compiling native code)
- Zlib devel (if compiling native code)
- Cyrus SASL devel (if compiling native code)
- One of the compilers that support thread_local storage: GCC 4.8.1 or later, Visual Studio,
Clang (community version), Clang (version for iOS 9 and later) (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)
- Doxygen ( if compiling libhdfspp and generating the documents )
- 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)
相关工具的安装
1、安装JDK1.7/JDK1.8(Hadoop2用JDK1.7,Hadoop3用JDK1.8)
2、安装maven
3、Native libraries:
sudo apt-get -y install build-essential autoconf automake libtool cmake zlib1g-dev pkg-config libssl-dev libsasl2-dev
4、安装Protocol Buffers(2.5.0版本和3.7.1版本)
通过export HADOOP_PROTOC_PATH指定编译时使用的protoc版本
安装protoc2.5.0:
下载压缩包,上传到机器,解压
cd /home/hadoop/protobuf-2.5.0
./configure --prefix=/usr/local/protobuf-2.5.0
make && make install
安装protoc3.7.1:
下载压缩包,上传到机器,解压
cd /home/hadoop/protobuf-3.7.1
sh autogen.sh
./configure --prefix=/usr/local
make && make in