7

我尝试使用 Ubuntu 16.04 在 Ubuntu VM 上安装和构建 Spark 2.0.0,如下所示:

  1. 安装 Java

    sudo apt-add-repository ppa:webupd8team/java
    sudo apt-get update       
    sudo apt-get install oracle-java8-installer
    
  2. 安装 Scala

    转到他们网站上的下载选项卡:scala-lang.org/download/all.html

    我使用了 Scala 2.11.8。

    sudo mkdir /usr/local/src/scala
    sudo tar -xvf scala-2.11.8.tgz -C /usr/local/src/scala/
    

    修改.bashrc文件并包含 scala 的路径:

    export SCALA_HOME=/usr/local/src/scala/scala-2.11.8
    export PATH=$SCALA_HOME/bin:$PATH
    

    然后输入:

    . .bashrc
    
  3. 安装 git

    sudo apt-get install git
    
  4. 下载并构建火花

    转至:http ://spark.apache.org/downloads.html

    下载 Spark 2.0.0(从源代码构建 - 用于独立模式)。

    tar -xvf spark-2.0.0.tgz
    cd into the Spark folder (that has been extracted).
    

    现在输入:

    ./build/sbt assembly
    

    完成安装后,我收到消息:

    [成功] 总时间:1940秒,完成...

    其次是日期和时间...

  5. 运行 Spark 外壳

    bin/spark-shell
    

就在那时,所有的地狱都崩溃了,我开始得到错误。我进入程序集文件夹以查找名为 target 的文件夹。但是那里没有这样的文件夹。汇编中唯一可见的内容是:pom.xml、README 和 src。

我在网上查了很长时间,但我一直无法找到一个可以帮助解决错误的具体解决方案。有人可以就如何解决这个问题提供明确的分步说明吗?!?现在快把我逼疯了……(TT)

错误截图:

在此处输入图像描述

4

3 回答 3

4

For some reason, Scala 2.11.8 is not working well while building but if I switch over to Scala 2.10.6 then it builds properly. I guess the reason I would need Scala in the first place is to get access to sbt to be able to build spark. Once its built, I need to direct myself to the spark folder and type:

build/sbt package

This will build the missing JAR files for me using Scala 2.11... kinda weird but that's how its working (I am assuming by looking at the logs).

Once spark builds again, type: bin/spark-shell (while being in the spark folder) and you'll have access to the spark shell.

于 2016-09-08T06:29:55.337 回答
3

spark 目录中键入sbt package ,而不是在 build 目录中。

于 2016-12-24T19:40:10.057 回答
0

如果您的目标确实是从您从http://spark.apache.org/downloads.html下载的源代码构建您的自定义 Spark 包,您应该执行以下操作:

./build/mvn -Phadoop-2.7,yarn,mesos,hive,hive-thriftserver -DskipTests clean install

您可能想阅读官方文档Building Spark

注意:您不必安装 Scala 和 git 包来构建 Spark,因此您可以跳过“2.安装 Scala”和“3.安装 git”步骤。

于 2016-12-24T20:02:23.973 回答