ubuntu install scala and spark

install java

先检查是否已经安装java

1
java -version

如果没有,按照如下步骤安装

1
2
3
4
5
6
7
sudo add-apt-repository ppa:webupd8team/java
sudo apt update
sudo apt install oracle-java8-installer
# check the java version
javac -version
# set java environment variables
sudo apt install oracle-java8-set-default

install scala

1
sudo apt-get install scala

直接这样安装可能scala版本较低,可以官网下载deb包然后sudo dpkg -i *.deb安装。

install spark

官网下载spark,注意选择清华源(mirrors.tuna.tsinghua.edu.cn)。

1
2
3
tar xvf spark-2.0.2-bin-hadoop2.7.tgz
cd spark-2.0.2-bin-hadoop2.7/bin
./spark-shell

references

Installing Scala and Spark on Ubuntu