一、下載源碼linux
地址:http://mirrors.hust.edu.cn/apache/hadoop/common/hadoop-2.7.5/hadoop-2.7.5-src.tar.gz二、
解壓縮 tar zxvf hadoop*.src.tar.gz -C 指定解壓目錄apache
三、用IDEA打開,因爲IDEA配置了MAVEN,自動識別爲maven項目centos
四、編譯maven
clean install package -Pdist,native -DskipTests -Dtaroop
五、遇到的坑ui
首先要安裝ant,yum install antspa
① findbugs .net
下載連接,可能比較慢:https://jaist.dl.sourceforge.net/project/findbugs/findbugs/3.0.1/findbugs-3.0.1.tar.gzcode
② protobuf :xml
關鍵字: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
若是不能聯網就去百度找包下載下來放上去吧