Labels

Thursday, March 29, 2012

UPDATE: Install R 2.14.2 or R 2.15 in Debian Squeeze

Since not so long, I upgraded  the version of R that is included in the Debian repositories (2.11.1 in Squeeze) and I was very happy with it since 2010. But there was some packages that I could not install and then, I decided to upgrade R despite of having to upgrade every package too (I have more than 1 GB in my home R packages folder).

There's nothing new or tricky about how to upgrade, the awesome guys of CRAN always brings an answer for our needs.

FIRST PART: ADD R BACKPORTS: 

First, open a Terminal and open the sources.list file:

$ gksudo gedit /etc/apt/sources.list

Then, add these lines at the bottom of the file (Note, I use the UCLA server, but this can be easily changed taking a look here for the mirrors):

## R BACKPORTS
deb http://cran.stat.ucla.edu/bin/linux/debian squeeze-cran/
#deb-src http://cran.stat.ucla.edu/bin/linux/debian squeeze-cran/

The original set of instructions can be seen here.

SECOND PART: RENAME THE R PACKAGES FOLDER:

There's a folder where R uses to store the packages we download, just rename it to the current version of R.
For example, mine was "2.11" and then I just renamed it to "2.14" (or "2.15", without quotes) and was inside this path:

Before:
/home/benjamin/R/x86_64-pc-linux-gnu-library/2.11
After:
/home/benjamin/R/x86_64-pc-linux-gnu-library/2.15

Remember that some packages also needs to install some files in folders that belongs to the root, so, I would recommend to open R in sudo mode (only if you're sure about what you're doing :P) just by executing R this way: "sudo R" and then, in the R console type :

update.packages(checkBuilt=TRUE, ask=FALSE)

THIRD PART: SECURE APT:

The Debian backports archives on CRAN are signed with the key ID 381BA480, to add them, in a Terminal prompt type:

gpg --keyserver pgp.mit.edu --recv-key 381BA480
gpg -a --export 381BA480 > jranke_cran.asc
sudo  apt-key add jranke_cran.asc

FOURTH PART: UPDATE AND UPGRADE R:

Save the file and you can either enter to Synaptic, update the packages list and then just upgrade the packages or in a terminal type:

sudo apt-get update
sudo apt-get upgrade

And that's all.
Benjamin

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.