I am new to Ubuntu. I want to install the latest Scala version 2.11.4 on my machine but the instructions on their website are cryptic to me. Can any one explain how to install it step by step?
The easiest way to install Scala would be to use the .deb installation file. On the download page you can see the newest stable version. Then go to the All Downloads page and find that version (or Scala 2.11.4). Scroll down to the bottom of that version's page and look for scala-2.11.4.deb (or the appropriate version) and download it.
If you're comfortable with the command line, you can install the downloaded Scala deb with:
sudo dpkg -i scala-2.11.4.deb
Otherwise, you're going to have to install GDebi through either the Ubuntu Software Center, or via a terminal with:
sudo apt-get install gdebi
Once GDebi is installed, you can double click scala-2.11.4.deb in your file browser which will open the package installer. Finally, click "Install Package", and your new version of Scala will be installed.
scala.deb and install it:
sudo apt-get remove scala-library scala wget http://www.scala-lang.org/files/archive/scala-2.11.6.deb sudo dpkg -i scala-2.11.6.deb sudo apt-get update
Installing scala 2.11.4 or any other version that is not in the Ubuntu repository or a PPA (mind though: scala will require JAVA and I assume you have this installed already. See the ubuntu help if you have not).
- download the file.
Extract the contents to somewhere on your system. I would opt for /opt/scala/. Something like:
tar xvfz ~/Downloads/scala-2.11.4.tgz /opt/ mv /opt/scala-2.11.4/ /opt/scala/
The readme in "docs" state you can run scala from the bin directory:
Decompress the archive and run the above commands directly from
bindirectory. We recommend adding the full path of the
bindirectory to the
... where you have the following tools:
- scala Scala interactive interpreter - scalac Scala compiler - fsc Scala resident compiler - scaladoc Scala API documentation generator - scalap Scala classfile decoder
So you would do
cd /opt/scala scala
to open the interpreter.
Regarding the PATH mentioned in the read me:
Add Scala to your $PATH by adding this line to
.profileinside your home directory
Mind that the path name needs to be named after what you extracted it too. Adding it would stop the need to do
cd /opt/scala/and you can envoke
scalafrom anywhere on your system.
Yes, the installation instructions on scala-lang.org are brief and assume a certain level of proficiency with setting up of environment variables. This assumption is also present in most of the answers here or on stackoverflow. another reson I wanted to add my answer is that there are no more .deb files available for downloading from scala-lang.org.
Recently I have successfully installed Scala 2.11.7 on my machine following these steps. It was a fresh Scala installation and Java 1.8 was already present.
Downloaded scala-2.11.7.tgz from http://www.scala-lang.org/download/ to my Downloads directory.
Navigate to the downloads directory and unpack the archive:
sudo tar xvfz scala-2.11.4.tgz
Move the unpacked directory to the directory indicated in the instructions:
mv scala-2.11.7 /usr/local/share/scala
Set the environment variables permanently. As indicated in the question on Stack Overflow here, and used by other software package installations, (e. g. I found Anaconda Python as the last automatic edit on it), one of reliable ways of doing it is by editing .bashrc file or adding these variables to the PATH directly with these commands:
export 'SCALA_HOME="/usr/local/share/scala"' >> ~/.bashrc export 'PATH="$PATH:$SCALA_HOME/bin"' >> ~/.bashrc
Reload the shell for the changes to take effect:
Now you can start Scala REPL from the command line by typing: