Translations of this page:
Trace: rproject_210

Installation of R 2.10

Installation of R 2.10

Additional libraries

No additional library is necessary.

Procedure

Installing R

  • Source or package? In this case, it is a really good question to ask oneself… Impilo's principal philosophy is to install from source as much as possible but for R, I decided to start from the packages that are found on R's web site. Many of the applications found in Impilo are dependent on a correct R install so let's save ourselves from a mighty headache!
  • First, you need to add a new package installation site for apt-get at www.probability.ca. In addition, you need to add the authentification key to make sure that apt-get will stay happy:
% sudo su
% echo "deb http://www.probability.ca/cran/bin/linux/ubuntu hardy/" >> /etc/apt/sources.list
//
// You also need to uncomment this line in /etc/apt/sources.list:
// deb http://ca.archive.ubuntu.com/ hardy-backports main restricted universe
//
% gpg --keyserver subkeys.pgp.net --recv-key E2A11821
% gpg -a --export E2A11821 | sudo apt-key add -
% exit
  • Secondly, you need to run apt-get to update the source list and install R:
% sudo apt-get update
% sudo apt-get install r-base r-base-dev

Installating the Rserve server

  • Before installing Bioconductor, you need to install Rserve, which is necessary to make sure that some MeV modules can work properly. Open R and install it from the R console:
% sudo R
//
// You are in the R console to install at system-level:
//
>install.packages("Rserve")
//
// It will ask for a mirror selection; take one close from home.
//
>q()
  • In /etc, you need to create a configuration file named Rserve.conf:
% sudo nano /etc/Rserve.conf
  • You need to put this in it:
workdir /tmp/Rserv
pwdfile 
remote disable
auth disable
plaintext disable
fileio enable
 
port <port>
maxinbuf 262144
 
maxsendbuf 0
uid 48
 
chroot 
sockmode 0
umask 0
 
encoding utf8
  • You are close to the finish line… To make sure that Rserve will start in deamon mode each time you boot the machine, you still need to do some work :-) Step 1: create a startup file: /etc/init.d/rserve:
% sudo nano /etc/init.d/rserve
  • This /etc/init.d/rserve file must contain the following lines:
#! /bin/sh
# chkconfig: 2345 99 01
# description: Rserve, /etc/init.d/rserve
 
case "$1" in
     start)
	echo -n "Starting Rserve daemon: "
	R CMD Rserve >/dev/null 2>&1
	echo "\t\t[STARTED]"
	;;
     stop)
	echo -n "Stopping Rserve daemon: "
	killall -s 9 Rserve
	echo "\t\t[STOPPED]"
	;;
     restart)
         echo -n "Stopping Rserve daemon: "
         killall -s 9 Rserve
         echo "\t\t[STOPPED]"
         echo -n "Starting Rserve daemon: "
         R CMD Rserve
         echo "\t\t[STARTED]"
         ;;
     *)
        echo "Usage: /etc/init.d/rserve {start|stop|restart}"
        exit 1
esac
 
exit 0
  • Make sure that only root can use this file and that the Rserve server process is started at boot time:
% sudo chown root:root /etc/init.d/rserve
% sudo chmod ugo+x /etc/init.d/rserve
% sudo update-rc.d rserve defaults
  • At boot, you should be able to see that the Rserve server has started.

Installation of a R GUI

There are many GUI for R but the one I chose is JGR. To install JGR, simply follow this recipe:

  • Tell R where are the Java components for the system:
% sudo R javareconf
  • From R, install the JGR package:
% sudo R
// We are in the R console at system-level
> install.packages('JGR')
// R will ask for a mirror selection
// Install will proceed simply enough. Give it a try:
> library(JGR)
> JGR()
// You should see a R console popping onto your dekstop
// with buttons, menus and everything else
  • The last step is adding R GUI to the Impilo aplication menu by editing the Xfce4 configuration file:
% sudo xfce4-menueditor /etc/xdg/xfce4/desktop/menu.xml
  • The three things to add are:
    • Item: Launcher
    • Name: R GUI
    • Command: /usr/local/lib/R/site-library/JGR/scripts/run