Thursday, February 26, 2015

Installing Scala on Ubuntu

Environment

  1. Scala 2.11.6
  2. Ubuntu 14.10



1. Installing Scala


The following commands have been tested, and are operational, under Ubuntu 14.10

1.1 Downloading the Latest Version

The latest version can be downloaded from the Scala site:
sudo wget http://www.scala-lang.org/files/archive/scala-2.11.6.tgz
The commands will download the scala archive to your current working directory.

1.2 Copy and Untar the Archive

I recommend copying the archive into this folder:
/usr/local/src/scala
Untar the file using this command:
sudo tar -zxvf scala-2.11.6.tgz



2. Modifying the Path


Modify both the PATH and CLASSPATH to point to the new Scala installation.

I like to use gedit to edit my environment file:
sudo gedit /etc/environment

The text in bold was added:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/src/scala/scala-2.11.6/bin"  
...  
export SCALA_HOME=/usr/local/src/scala/scala-2.11.6

Once the environment file is saved, reload it:
source /etc/environment



3. Verifying the Installation


If the installation and environment editing were both successful, you should be able to find the version of scala on the terminal session:
craig@U14BASEBIG01:/usr/local/src/scala/scala-2.10.4$ scala -version
Scala code runner version 2.11.6 -- Copyright 2002-2013, LAMP/EPFL

You should also be able to enter the scala interactive shell by just typing scala:
craig@U14BASEBIG01:/usr/local/src/scala/scala-2.10.4$ scala
Welcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_31).  
Type in expressions to have them evaluated.  
Type :help for more information.  
scala>   



References

  1. [Blog] Installing Apache Spark on 14.04

No comments:

Post a Comment