Installing Scala environment on Debian Linux
Scala is a programming language with both imperative and functional capabilities.
Scala home page is located here:

This document explains how to install Scala command line environment version 2.10.3.
To install Scala IDE for Eclipse go here: Installing Scala IDE for Eclipse

Scala needs Java runtime to work. If you do not have Java installed see Installing JDK on Linux first.
This document assumes you have root access to your Linux box. If not you should install Scala somewhere in your home directory.
Later on you can modify /home/{user}/.bashrc to add Scala binaries folder to your PATH variable:

export PATH=/home/{user}/scala-2.10.3/bin:$PATH

Download Scala
Open this link in your browser:
Find scala-2.10.3.tgz and save it to disk (e.g. to Downloads directory).

If you have root access:

cd /opt
mkdir scala
cd scala
mv /home/{user}/Downloads/scala-2.10.3.tgz .
tar xvf scala-2.10.3.tgz

At this point you should see /opt/scala/scala-2.10.3 directory (owned by root user).
Having a default link will help with upgrading Scala version later on. Once you download a new version you can remove that link and create a new one with the same name but pointed to new directory.

rm scala-2.10.3.tgz
ln -s scala-2.10.3 default

Create links in /etc/alternatives

cd /etc/alternatives
ln -s /opt/scala/default/bin/scala
ln -s /opt/scala/default/bin/scalac
ln -s /opt/scala/default/bin/scalap
ln -s /opt/scala/default/bin/scaladoc

Command ln usually takes 2 parameters (source file name and target file name) but if target file name is the same as source file name you can skip the second parameter.

Create links in /usr/local/bin

cd /usr/local/bin
ln -s /etc/alternatives/scala
ln -s /etc/alternatives/scalac
ln -s /etc/alternatives/scalap
ln -s /etc/alternatives/scaladoc

Check if scala executable is visible:

which scala
// should print /usr/local/bin/scala

If that does not work check if /usr/local/bin is part of default path:

set | grep PATH

On my system that prints:

If you do not see /usr/local/bin edit your /etc/profile file:

cd /etc
vi profile
// add this line at the end:
export PATH=/usr/local/bin:$PATH

Test scala command
Run those commands as regular user:

cd /home/{user}

You should see the following text:

Welcome to Scala version 2.10.3 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_05).
Type in expressions to have them evaluated.
Type :help for more information.


Type exit to leave Scala console.