How to install 2 different R versions on Debian?

Joris Meys picture Joris Meys · Dec 1, 2011 · Viewed 7.7k times · Source

On our server, R 2.12.1 is installed following the instructions on http://cran.r-project.org/bin/linux/debian/ , using apt-get install etc etc.

Due to circumstances the old lenny machine hasn't been updated to the new stable debian, and it looks like this isn't about to happen soon. As some of the research here depends on the latest version of VGAM, we need the R 2.14.0 installed on debian. But in order to keep old code running, we can't just drop the R 2.12.1 (installing the VGAM 0.8.4 on this version gives errors).

So we need to install 2 R-versions. From the little I understood, if we just use apt-get upgrade the old version will be replaced by the new. I've been going through heaps of documentation, but I can't find the optimal way of doing so.

The only thing I could imagine now, is to try to build the latest R from source, but my colleagues were not very keen on that idea and prompted me to first look for another solution. Any info I missed, or is somebody willing to show me the little trick to get this done? If building from source is the solution, I'd like to hear about any pitfalls or possible problems.

Answer

oz123 picture oz123 · Dec 1, 2011

You can install different versions of ANY software using proper compile flags. When you run the configure script with --help you should see an option to see the install root.

Take a look at

./configure --help
...
Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local]

so you could install R-2.14 to:

/usr/local/R/2.14

and you could install R-2.12 to:

/usr/local/R/2.12

when you launch the configure script do:

./configure --prefix=/usr/local/R/2.14

and so on.