hadoop源码版本:2.7.7
maven版本:
protobuf版本:
ant版本:
以上环境的搭建网上有很多说明,这里放一篇参考,我就是按这篇博客里的步骤来做的:
https://www.cnblogs.com/duking1991/p/6104304.html
需要注意的是这篇博客中使用的操作系统是centOS,安装软件的工具是yum,而我用的是ubantu,安装工具是apt-get,所以在这一步
需要把它换成:
apt-get install lzo-devel zlib-devel autoconf automake libtool cmake openssl-devel
接下里就说说安装过程中遇到的错误:
Error 1
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (dist) on project hadoop-kms: An Ant BuildException has occured: java.net.ConnectException: Connection timed out (Connection timed out)
[ERROR] around Ant part ...
出现这个错误的原因是连接不上服务器下载tomcat,他要求的这个tomcat版本是6.0.48,在官网上都下不到了,我尝试过去/home/lc/Documents/hadoop-2.7.7-src/hadoop-common-project/hadoop-kms/target/antrun/build-main.xml修改下载链接,但是发现改完再编译它又恢复回去了,不知道该在哪里改,于是乎只能去网上找apache-tomcat-6.0.48包,然后把它打包成apache-tomcat-6.0.48.tar.gz格式(先tar,再gzip),然后把它放在/home/lc/Documents/hadoop-2.7.7-src/hadoop-common-project/hadoop-kms/downloads下,因为build-main.xml文件就是说下载后放在这里,我们提前放在这里,它就不会再去下载了。
然后再编译,发现错误提示/home/lc/Documents/hadoop-2.7.7-src/hadoop-hdfs-project/hadoop-hdfs-httpfs/downloads下也需要一份apache-tomcat-6.0.48.tar.gz,所以在这里也放一份,不然它自己去下又找不到,然后就OK了。
Error 2
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 52.838 s
[INFO] Finished at: 2019-05-18T22:16:59-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase "–Pdist,native". You must specify a valid lifecycle phase or a goal in the format
出现这个错误完全是粗心大意,命令行中的“-”用的是中文字符,所以报错,换成英文的就好
Error 3
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.917 s
[INFO] Finished at: 2019-05-18T22:52:33-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project hadoop-build-tools: Failed to clean project: Failed to delete /home/lc/Documents/hadoop-2.7.7-src/hadoop-build-tools/target/maven-archiver/pom.properties -> [Help 1]
重新编译时删不掉原来的文件,一看就是权限问题,换成root权限。
相比网上其他人说的编译两个小时,我只用了9分钟,可能是因为实验室网快还有服务器好吧!
编译好的文件在hadoop-2.7.7-src/hadoop-dist/target下,hadoop-2.7.7.tar.gz 。
最后总结一下,编译过程中出现错误很正常,我们要去看打印出来的错误信息,找到错误原因,然后对症下药,只要有耐心和决心,一切都会解决的!