1、首先在官网下载http://spark.apache.org/downloads.html, 选择与hadoop对应的版本,对应关系为:spark1.6.2--scala2.10;spark2.0.0--scala2.11 http://mirrors.hust.edu.cn/apache/spark/spark-2.2.2/spark-2.2.2-bin-hadoop2.7.tgz 在终端中输入wget http://d3kbcqa49mib13.cloudfront.net/spark-1.6.2-bin-hadoop2.6.tgz(此处粘贴刚才复制的链接进行下载),或直接下载都可 2、解压下载的spark 输入tar -zxvf spark-1.6.2-bin-hadoop2.6.tgz进行解压 3、cd conf/ 将log4j文件复制出来一份 cp log4j.properties.template log4j.properties 进入文件并将rootCategory 的INFO级别改成WARN log4j.properties spark-env.sh 复制一份并在最后添加 export JAVA_HOME=/opt/jdk/jdk1.8.0_161 export SCALA_HOME=/opt/Servers/scala-2.11.8 export SPARK_MASTER_IP=localhost export SPARK_WORKER_MEMORY=4G 4、配置环境变量~/.bashrc #Spark export SPARK_HOME=/opt/Servers/spark-2.3.2-bin-hadoop2.7 export PATH=$PATH:${SPARK_HOME}/bin 5、修改host 192.168.35.152 localhost 6、启动 $SPARK_HOME/sbin/start-all.sh 停止 $SPARK_HOME/sbin/stop-all.sh 测试Spark是否安装成功: $SPARK_HOME/bin/run-example SparkPi 得到结果: Pi is roughly 3.14716 检查WebUI,浏览器打开端口: http://localhost :8080 需要本地别占用8080端口 在spark上执行task spark-submit --master spark://10.10.5.246:7077 --name WordCountByscala --class luozt_scala.spark.wordcount --executor-memory 1G --total-executor-cores 2 /home/luozt/spark/spark0824.jar /home/luozt/spark/README.md 修改spark ui的运行端口 进入spark的bin目录 修改start-master.sh SPARK_MASTER_WEBUI_PORT=9090
标签:bin,--,export,linux,HOME,spark,安装,SPARK From: https://www.cnblogs.com/robots2/p/18647383