1. 下载scala
到scala官网下载scala https://www.scala-lang.org/download/,目前最新版本是2.12.8
wget https://downloads.lightbend.com/scala/2.12.8/scala-2.12.8.tgz #download scala binary file mkdir /usr/local/scala #create folder to put the unzipped scala file into tar -xvzf scala-2.12.8.tgz && mv scala-2.12.8 /usr/local/scala/ #unzip scala binary file and move to the /usr/local/scala
2. 配置环境变量
vim /etc/profile #add scala info to enviroment file.
在文件末尾添加以下内容
#scala export SCALA_HOME=/usr/local/scala/scala-2.12.8 export PATH=$SCALA_HOME/bin:$PATH
:wq保存退出
3. 使环境变量生效
source /etc/profil
4. 控制台输入scala -version
lenmom@M1701:~/workspace$ scala -version Scala code runner version 2.12.8 -- Copyright 2002-2018, LAMP/EPFL and Lightbend, Inc.
正常返回版本信息,说明scala安装成功.