[R] Installing different versions of R simultaneously on Linux

Berwin A Turlach berwin at maths.uwa.edu.au
Fri Feb 27 12:49:59 CET 2009


G'day Rainer,

On Fri, 27 Feb 2009 10:53:12 +0200
Rainer M Krug <r.m.krug at gmail.com> wrote:

> > What flavour of Linux are we talking about?
> 
> Sorry - I am running SuSE on the machine where I need it.

Sorry, I am not familiar with that flavour; before switching to Debian
(and Debian based distributions), I was using RedHat.  And before that
Slackware.

> > 4) Run in /opt/src a script that uses "update-alternative" install
> > to install the new version and creates a link
> > from /opt/R/R-x.y.z/bin/R to /opt/bin/R-x.y.z
> 
> How do I do this? I usually call "sudo make install". Do I have to use
> "update-alternative --install R-2.7.1 R 2" if I want to have R-2.7.1
> aqs the second priority installed?

I do the "make install" step manually, the script just alerts the
system that another alternative for the R command was installed.

If memory serves correctly, the "alternatives" mechanism was developed
by Debian and adopted by RedHat (or the other way round).  I am not
sure whether SuSE has adopted this, or a similar system.

Essentially, for a command, say foo, for which several alternatives
exists, is installed on the system in, say /usr/bin/, as a link
to /etc/alternatives/foo and /etc/alternatives/foo is a link to the
actual program that is called.  

E.g. on my machine I have

berwin at berwin-nus1:~$ update-alternatives --list wish
/usr/bin/wish8.5
/usr/bin/wish8.4

which tells me that wish 8.5 and wish8.4 are installed and I could call
them explicitly.  /usr/bin/wish is a link to /etc/alternatives/wish
and /etc/alternatives/wish will point to either of these two programs
(depending on what the system admin decided should be the default, i.e.
should be used if a user just types 'wish').  

A command like "update-alternatives --config wish" allows to configure
whether "wish" should mean "wish8.5" or "wish8.4".  And all that is
necessary is to change the link in /etc/alternatives/wish to point at
the desired program.

> That is what I need - but I can't find update-alternatives in SuSE

As I said, I do not know whether SuSE offers this alternatives system
or a similar system.  If it does, perhaps it is just a matter of
installing some additional packages?  If it offers a different, but
similar system, then you would have to ask on a SuSE list on that
system is maintained and configured.

On my machine I would say "apt-file search update-alternatives" to find
out which package provides that command and to install that package if
it is not yet installed.  I am afraid I do not know what the equivalent
command on SuSE is.

> > Typing R alone, will usually start the most recently installed
> > version (as this will have the highest priority) but I can configure
> > that via "sudo update-alternatives --config R". __I.e., I can make R
> > run a particular version. __Since the "update-alternative" step
> > above also registers all the *.info files and man pages, I will
> > also access the documentation of that particular R version (e.g.,
> > C-h i in emacs will give me access to the info version of the
> > manuals of the version of R which is run by the R command).
> 
> Exactly what I would like to have.

Well, if you ever use a system that has the alternatives set up and the
update-alternatives command, I am happy to share my script with you. 

Cheers,

	Berwin




More information about the R-help mailing list