0。环境说明:
编译所用的操作系统为:
[root@host11 hadoop-2.7.1-src] #猫/etc/redhat-release
CentOS 6.5版本(最终)
hadoop的版本为2.7.1
1。安装依赖软件包:
yum安装svn autoconf automake libtool cmake ncurses-devel openssl-devel gcc *
2。配置java和maven环境:
wget wget http://download.oracle.com/otn-pub/java/jdk/8u60-b27/jdk-8u60-linux-x64.tar.gz?AuthParam=1443446776 _174368b9ab1a6a92468aba5cd4d092d0
焦油-zxvf jdk-8u60-linux-x64.tar。gz - c/usr/local cd/usr/local
ln - s jdk1.8.0_60 jdk
echo '出口JAVA_HOME=/usr/地方/jdk的祝辞在/etc/profile;
回声的出口路径=$ JAVA_HOME/bin: $路径的祝辞在/etc/profile;
wget http://mirrors.hust.edu.cn/apache/maven/maven-3/3.3.3/binaries/apache-maven-3.3.3-bin.tar.gz
焦油-zxvf apache-maven-3.3.3-bin.tar。gz - c/usr/local cd/usr/local
ln - s apache-maven-3.3.3 maven
回声的出口路径=/usr/本地maven/bin/: $路径'在/etc/profile.d/maven.sh;
3。下载并安装protobuf(必须使用2.5版本)
wget https://codeload.github.com/google/protobuf/zip/v2.5.0
解压protobuf-2.5.0。zip
wget http://googletest.googlecode.com/files/gtest-1.5.0.tar.bz2
焦油-jxvf gtest-1.5.0.tar。bz2
获取mv gtest-1.5.0。/protobuf-2.5.0/gt
。/任务
。/配置
进行核对使安装
protoc
[root@host11 protobuf-master] #这protoc
/usr/地方/bin/protoc
4。下载并安装ant:
wget http://mirrors.cnnic.cn/apache//ant/binaries/apache-ant-1.9.6-bin.zip
解压apache-ant-1.9.6-bin。zip
mv apache-ant-1.9.6/usr/local/ant
回声的出口路径=/usr/地方/ant/bin: $路径'在/etc/profile.d/ant.sh
5。编译hadoop:
焦油-zxvf焦油-zxvf hadoop-2.7.1-src.tar。广州
mvn包-Pdist,本机-DskipTests -Dtar
6。故障处理:
第一次编译故障:
(错误)未能执行目标>(错误),
(错误)看到完整的堆栈跟踪的错误,重新运行Maven - e的开关。
(错误)重新运行Maven使用- x开关,使完整的调试日志记录。
(错误),
(误差)对错误和可能的解决方案的更多信息,请阅读以下文章:
(错误)[1]帮助http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
(错误),
错误纠正的问题后,你可以重新构建命令
(错误),mvn & lt; goals>射频:hadoop-auth
解决办法:
这种情况很常见,这是因为插件没有下载完毕造成的。多执行几次下面命令就可以了
mvn包-Pdist,本机-DskipTests -Dtar
第二次编译故障:
(错误)未能执行目标org.apache.hadoop: hadoop-maven-plugins: 2.7.1: protoc (compile-protoc)>
protobuf版本过新,需要使用的2.5版本;
7。编译成功的日志:
[信息]Apache Hadoop主.................................成功的[s], 7.502
[信息]POM .......................... Apache Hadoop项目成功的[s], 4.844
[信息].......................... Apache Hadoop注释成功(10.274秒)
[信息]Apache Hadoop组件...........................成功的[s], 0.477
[信息]Dist POM ..................... Apache Hadoop项目成功的[s], 4.568
[信息]Apache Hadoop ........................ Maven插件成功(11.000秒)
[信息]Apache Hadoop MiniKDC ..............................成功的[s], 9.870
[信息]Apache Hadoop Auth .................................成功的[s], 9.003
[信息]Apache Hadoop Auth ........................例子成功的[s], 9.321
[信息]............................... Apache Hadoop常见成功(03:21 min)
[信息]Apache Hadoop NFS ..................................成功(20.029秒)
Apache Hadoop公里..................................[信息]成功(21.350秒)
[信息]Apache Hadoop .......................常见的项目成功的[s], 0.079
Apache Hadoop的HDFS .................................[信息]成功(10:57 min)
[信息]Apache Hadoop HttpFS ...............................成功(01:15 min)
[信息]Apache Hadoop的HDFS簿记员..............》杂志上成功(46.255秒)
[信息]Apache Hadoop HDFS-NFS .............................成功(21.495秒)
[信息]......................... Apache Hadoop的HDFS项目成功的[s], 0.242
[信息]hadoop-yarn ........................................成功的[s], 0.137
[信息]hadoop-yarn-api ....................................成功(01:34 min)
[信息]hadoop-yarn-common .................................成功(01:31 min)
[信息]hadoop-yarn-server .................................成功的[s], 0.291