How to install Scala on Debian/Ubuntu (Scala 2.9.0.1, 2.8.1)

Update: Scala 2.9.0.1 (hotfixes to 2.9.0, released on May 12) was released on May 25, 2011. In this tip you can find a way how to install it (and older version - 2.8.1) onto yours Ubuntu/Debian box.

Ubuntu default apt repository gives us option to install only scala-2.7.7, but if you want to use latest version of scala (2.9.0.1 2.8.1 to date when this tip was written), so all what we need to do is this actions:

$ wget http://www.scala-lang.org/downloads/distrib/files/scala-2.9.0.1.tgz
$ tar zxf scala-2.9.0.1.tgz
$ sudo mv scala-2.9.0.1 /usr/share/scala

But if you need to install older (2.8.1) version of scala you need to run next commands:

$ wget http://www.scala-lang.org/downloads/distrib/files/scala-2.8.1.final.tgz
$ tar zxf scala-2.8.1.final.tgz
$ sudo mv scala-2.8.1.final /usr/share/scala

Ok, now you we need to make a few links to scala binary, scalac (scala compiler), fsc (fast scala compiler) and others scala executables:

$ sudo ln -s /usr/share/scala/bin/scala /usr/bin/scala
$ sudo ln -s /usr/share/scala/bin/scalac /usr/bin/scalac
$ sudo ln -s /usr/share/scala/bin/fsc /usr/bin/fsc
$ sudo ln -s /usr/share/scala/bin/sbaz /usr/bin/sbaz
$ sudo ln -s /usr/share/scala/bin/sbaz-setup /usr/bin/sbaz-setup
$ sudo ln -s /usr/share/scala/bin/scaladoc /usr/bin/scaladoc
$ sudo ln -s /usr/share/scala/bin/scalap /usr/bin/scalap

And how to uninstall (for both versions of scala):

$ sudo rm -rf /usr/share/scala /usr/bin/scala /usr/bin/scalac /usr/bin/fsc /usr/bin/sbaz /usr/bin/sbaz-setup /usr/bin/scaladoc /usr/bin/scalap
A+ a-
Clip in Evernote