centos6.5 中 git+maven 编译 spark过程

centos6.5中使用git+maven编译spark踩到了很多坑,最后成功编译。所以发篇文章记录一下,希望能给后面遇到相同问题的人一些帮助。
首先要安装 maven 3.3 +,如果没有安装可以百度一下具体步骤。

1. 首先是从github中clone spark源码 报错如下:
使用git clone 源码报错 :
git clone
[root@nebo1 opensource]# git clone http://github.com/apache/spark.git
Initialized empty Git repository in /home/hadoop/projects/opensource/spark/.git/
error: while accessing http://github.com/apache/spark.git/info/refs

fatal: HTTP request failed

[root@nebo1 opensource]# git clone [email protected]:apache/spark.git
Initialized empty Git repository in /home/hadoop/projects/opensource/spark/.git/
The authenticity of host ‘github.com (192.30.253.113)’ can’t be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘github.com,192.30.253.113’ (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
原因是centos6.5中git安装是1.7.1 版本较低,所以安装较高版本。
所以更新git
或者这里写图片描述
git://替换http(s)://

https://www.kernel.org/pub/software/scm/git/git-2.10.1.tar.gz

在更新git之前我win主机发现ping github 不通。所以在win 还有 虚拟机的hosts文件都增加了如下内容:
192.30.253.113 github.com
192.30.252.131 github.com
185.31.16.185 github.global.ssl.fastly.net
74.125.237.1 dl-ssl.google.com
173.194.127.200 groups.google.com
192.30.252.131 github.com
185.31.16.185 github.global.ssl.fastly.net
74.125.128.95 ajax.googleapis.com

2.下载之后载解压:出现了这样的错误:
gzip: stdin: unexpected end of file
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now

发现下载的压缩包只有1.x m ,应该是网络问题导致下载的压缩包不完整。
所以重新下载一遍。解压git 就可以了(下载之后具体步骤可以搜索博客查看)。

3.然后git 再次clone spark 仓库
err 提示 SSL connect error 如下图
这里写图片描述

解决方法: 更新nss
yum update nss

4.再次克隆, err:

正克隆到 ‘spark’…
remote: Counting objects: 530933, done.
remote: Compressing objects: 100% (135/135), done.
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: 过早的文件结束符(EOF)
fatal: index-pack failed
解决方法:
git config –global http.postBuffer 52428800

524288000代表B,524288000B也就是500MB。这个值得大小,自己可以根据情况设置。
也可以用如下命令查看是否配置成功:
git config –list

最终克隆成功

5.执行编译命令,(p:2.6, 2.7.1 根据自身版本设置)
./make-distribution.sh –name custom-spark –tgz -Psparkr -Phadoop-2.6 -Dhadoop.version=2.7.1 -Phive -Phive-thriftserver -Pyarn //在spark 源码父目录下执行
报错如下: java heap space
centos6.5 中 git+maven 编译 spark过程_第1张图片
原因 以及解决方法:
centos6.5 中 git+maven 编译 spark过程_第2张图片
在 对应文件中 配置
export MAVEN_OPTS=”-Xmx2g -XX:MaxPermSize=512M -XX:ReservedCodeCacheSize=512m”
我配置在了/etc/profile 中

6.编译 err:
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.4.0:exec (sparkr-pkg) on project spark-core_2.10: Command execution failed. Process exited with an error: 127 (Exit value: 127) -> [Help 1]
centos6.5 中 git+maven 编译 spark过程_第3张图片
解决方法:
yum list epel*
yum install epel-release
然后 yum install R

7.安装到一半断网了…..
再下次使用yum命令时会提示:There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them。

yum -y install yum-utils
然后执行
yum-complete-transaction

补充如果遇到某个jar失败,可以根据pom.xml 中地址(或许需要访问)下载之后 mvn install
如下:
mvn install:install-file -DgroupId=org.eclipse.paho
-DartifactId=org.eclipse.paho.client.mqttv3
-Dversion=1.0.1
-Dpackaing=jar
-Dfile=/home/hadoop/projects/opensource/org.eclipse.paho.client.mqttv3-1.0.1.jar

以上是本人在编译过程中遇到的一些坑。希望大家可以绕过这些!

你可能感兴趣的:(maven,bigdata)