To install Scala, it requires the Java run time version 1.8 or later. Once we have Java installed and configured, we can download the Scala distribution in RHEL or Cent OS using this command

1
wget http://www.scala-lang.org/files/archive/scala-2.12.1.tgz

Once the download is done, we will extract the distribution at the given location /usr/lib

1
sudo tar -xf scala-2.12.1.tgz -C /usr/lib

Lets create symbolic link to the scala directory

1
sudo ln -s /usr/lib/scala-2.12.1 /usr/lib/scala

Now we will add the scala bin directory to PATH

1
export PATH=$PATH:/usr/lib/scala/bin

Thats all we have to do. Now we can check our scala installation using the command

1
scala -version

It should print the following in terminal

Scala code runner version 2.12.1 -- Copyright 2002-2016, LAMP/EPFL and Lightbend, Inc.