1、下载源码
地址:http://mirrors.hust.edu.cn/apache/hadoop/common/hadoop-2.7.5/hadoop-2.7.5-src.tar.gz2、
解压缩 tar zxvf hadoop*.src.tar.gz -C 指定解压目录
3、用IDEA打开,由于IDEA配置了MAVEN,自动识别为maven项目
4、编译
clean install package -Pdist,native -DskipTests -Dtar
5、遇到的坑
首先要安装ant,yum install ant
① findbugs
下载链接,可能比较慢:https://jaist.dl.sourceforge.net/project/findbugs/findbugs/3.0.1/findbugs-3.0.1.tar.gz
② protobuf :
关键字:protobuf
编译安装,配置环境变量即可
[ERROR] Failed to execute goal
org.apache.hadoop:hadoop-maven-plugins:2.7.1:protoc (compile-protoc) on
project hadoop-common: org.apache.maven.plugin.MojoExecutionException: ‘protoc –version’ did not return a version -> [Help 1]
③cmake:如果没有安装需要先安装cmake
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (make) on project hadoop-common: An Ant BuildException has occured:
exec returned: 1 [ERROR] around Ant part …<exec dir=”/home/work/workplace/hadoop/hadoop-2.7.5/hadoop-common-project/hadoop-common/target/native” executable=”cmake”
failonerror=”true”>… @ 4:152 in /home/linuxidc/workplace/hadoop/hadoop-2.6.0-src/hadoop-common-project/hadoop-common/target/antrun/build-main.xml
关键词:cmake,查看cmake是否安装,cmake -version,已存在,经百度,需要安装另外两个库
centos下命令是:yum install zlib-devel,openssl-devel
如果不能联网就去百度找包下载下来放上去吧