This article is about how to install Scala on Ubuntu. First off, you need Java installed. Scala programs compile to Java bytecode, which means you need the Java virtual machine in order to run your Scala programs. My advice is to install the sun-java6-jdk package. There are open-source Java implementations, but they suck. The Sun one is much better (the fact that it actually works is my main reason for using it).
Now the next step you might think is to then install the scala package from the Ubuntu repositories. Unfortunately as of today, that version is 2.3, and the most up-to-date one from the Scala pages is 2.7 (UPDATE Dec. 20/09: The version in the repo is 2.7.5 now, which is still not the latest version). You're much better off just doing this:
wget http://www.scala-lang.org/downloads/distrib/files/scala-2.7.7.final.tgzNow you have a working Scala implementation! Make sure to check the most up-to-date version on their website. I'll try and keep this up-to-date, but I'm only human and only check the Scala website every now and then.
tar -zxvf scala-2.7.7.final.tgz
sudo mv scala-2.7.7.final /usr/share/scala
sudo ln -s /usr/share/scala/bin/scala /usr/bin/scala
sudo ln -s /usr/share/scala/bin/scalac /usr/bin/scalac
To uninstall:
sudo rm -rf /usr/share/scala /usr/bin/scala /usr/bin/scalac
9 comments:
mkdir -p /usr/share/vim/addons/ftdetect
mkdir -p /usr/share/vim/addons/indent
mkdir -p /usr/share/vim/addons/syntax
wget --no-check-certificate https://lampsvn.epfl.ch/trac/scala/browser/scala-tool-support/trunk/src/vim/ftdetect/scala.vim?format=raw -O /usr/share/vim/addons/ftdetect/scala.vim
wget --no-check-certificate https://lampsvn.epfl.ch/trac/scala/browser/scala-tool-support/trunk/src/vim/indent/scala.vim?format=raw -O /usr/share/vim/addons/indent/scala.vim
wget --no-check-certificate https://lampsvn.epfl.ch/trac/scala/browser/scala-tool-support/trunk/src/vim/syntax/scala.vim?format=raw -O /usr/share/vim/addons/syntax/scala.vim
mkdir -p /usr/share/vim/vimcurrent/ftdetect
mkdir -p /usr/share/vim/vimcurrent/indent
mkdir -p /usr/share/vim/vimcurrent/syntax
wget --no-check-certificate https://lampsvn.epfl.ch/trac/scala/browser/scala-tool-support/trunk/src/vim/ftdetect/scala.vim?format=raw -O /usr/share/vim/vimcurrent/ftdetect/scala.vim
wget --no-check-certificate https://lampsvn.epfl.ch/trac/scala/browser/scala-tool-support/trunk/src/vim/indent/scala.vim?format=raw -O /usr/share/vim/vimcurrent/indent/scala.vim
wget --no-check-certificate https://lampsvn.epfl.ch/trac/scala/browser/scala-tool-support/trunk/src/vim/syntax/scala.vim?format=raw -O /usr/share/vim/vimcurrent/syntax/scala.vim
Thank you Anonymous (whoever you are!).
The three links that you can see here are the filetype detection (ftdetect), indentation settings and syntax highlighting details for programming Scala in Vim. Always handy!
You'll need to run this stuff as root, or use sudo to do it. I wonder if there is a way to do it for an individual user?
For an individual user, use ~/.vim/ instead of /usr/share/vim/vimcurrent.
Much Obliged Friend!
Worked without a single hitch.
Sooth!
Regards,
B
You can now install Scala from the Ubuntu Repo:
sudo apt-get install scala
Tried it. Works.
Obliged again.
Regards,
Bernard
Gabriel: Yes, you've been able to get it from the Ubuntu repos for a long time now, however it is rarely the up-to-date version. Right now they've updated it to 2.7.5 and the latest version is 2.7.7 so it isn't that far apart, but they haven't been too quick to update.
I'm not exactly the fastest updater for this either, but I'm just saying that if you want the latest and greatest, go with the Scala site - although for any package, they aren't usually up to date in the repos.
Bernard: No problem!
Thank you for the excellent post. As a small addition I found it useful to include:
sudo ln -s /usr/share/scala/bin/fsc /usr/bin/fsc
This provides easy access to the scala fast compiler.
To uninstall becomes:
sudo rm -rf /usr/share/scala /usr/bin/scala /usr/bin/scalac /usr/bin/sfc
Post a Comment