In this article, we are going to cover Installing Scala on Ubuntu Linux.
Installing Scala on Ubuntu Linux is a relatively simple procedure which is described in following steps.

Installation Environment & Software Prerequisites

OS : Ubuntu Linux(14.04 LTS) – 64bit
Java : Oracle JDK 1.8
Scala : Scala-2.11.7

Step 1: Java-JDK Installation:

In one of our previous article, We have provided step by step guide to install Java in Ubuntu Linux, so we can skip this Java installation step here.

Step 2: Download Scala:

For Scala installation, we need to select appropriate Scala version.
In our case, we are interested in installing Scala-2.11.7.
We have downloaded Scala from link.

Step 3: Scala Installation:

Once the file is downloaded, we have to select appropriate location in the system to save the Scala.
I have selected the path like,/usr/local/scala/<Different_Scala_Versions>

Step 4: Create a folder using mkdir command for saving Scala installation files

So, in order to save Scala files, we have to create a folder under /usr/local,

I have created a folder using below command,

$ sudo mkdir /usr/local/scala

Step 5: Extract tar file content using the tar command

Once the folder is created, we have to extract the file that we have downloaded from Scala’s website.

I have downloaded and placed that file to,/home/javadeveloperzone/Desktop

So I have to execute below command for extracting the file,

$ tar -xvf scala-2.11.7.tgz

Step 6: Move folder content using mv command

Now we have to move the extracted folder to the location at which we want to save (in our case /usr/local/scala/).

I have used below command to move the extracted files to /usr/local/scala/.

$ sudo mv scala-2.11.7 /usr/local/scala

Step 7: Set permission using chmod command on scala folder

Once the files are moved, it is time to get appropriate permissions on the folder,

I have used below command to acquire appropriate permission.

$ sudo chmod -R 777 /usr/local/scala/scala-2.11.7/

Now the setup part is almost done, we will start the configuration part,

In the configuration step, we have to set SCALA_HOME variable, In order to set the variable, we have to add them in $HOME/.bashrc file.

I have used gedit $HOME/.bashrccommand to open the file, you can use any of your favorite editor to open the file and append the below lines to that file.

After modifying the .bashrcfile, my .bashrcfile looks like the following snapshot.



Step 8: Run/Apply bashrc file changes

Now we have to execute the following command so that the SCALA_HOMEvariable will take effect,

$ source $HOME/.bashrc

Once the configuration is complete, your scala is ready to use, so this is how you can install scala on ubuntu linux.
you can use scala command to start scala shell.

What’s next?

After Installing Scala on Ubuntu Linux, you might be interested in scala hello world example which can be found here.

Was this post helpful?
Let us know, if you liked the post. Only in this way, we can improve us.

Leave a Reply

Your email address will not be published. Required fields are marked *