[R] How to install R on Linux via source compilation?

John jwd at surewest.net
Mon Oct 18 06:15:38 CEST 2010


On Sunday, October 17, 2010 10:27:48 am noclue_ wrote:
> How to install R on Linux via source compilation?
> Has anybody done it?
> I could not find step by step instructions online.
> 
> I would appreciate if you could share your experience.
> 

If you are new to linux, I would strongly recommend using a package manager 
for your release (e.g. apt-get for ubuntu) and using the available binary.  If 
you need to be on the bleeding edge then you will have to compile and install.

Download the source archive, e.g. R-2.12.0.tar.gz, from CRAN.  The simplest 
route from here would to bring up a BASH terminal and cd to the directory 
where the file was written during download.

Uncompress it using tar, e.g. tar xzvf R-2.12.0,tar.gz

That should uncompress the file to a new sub directory within the download 
directory.  For instance, if your download directory is /home/<your user 
name>/downloads, then the new directory will be /home/<your user 
name>/downloads/R-2.12.0.  Change to that directory.  Listing the contents 
will show you a number of files including a file named "INSTALL."  Read that file 
first.  Then check the other files it points to before doing anything else.  It 
gives directions on the compilation and installation process for local or 
site-wide installation.

The INSTALL file tells you run "configure."  You will need to execute that file 
by typing "./configure" since you want to execute that specific configure script 
rather than another one that might be lurking somewhere in the path.  Configure 
will stream a loooonnnngggg list of "checking ...." messages.  If critical 
elements are missing it will halt and give a message such as:

configure: error: --with-x=yes (default) and X11 headers/libs are not available

Every error that halts configure will need to be corrected by installing the 
missing element or adding a symbolic link to the correct file in the directory 
where configure looks for it.  Many of the missing elements will available 
through the "development" packages that various releases of linux offer.  The 
process will likely be incremental as each fix and execution will allow 
configure to run a little longer until the next error is encountered.  Configure 
generates a file config.log that is informative about what is taking place.  
Grepping that file for the term "error" will probably produce a substantial 
list of less than critical errors.  

Once you have a clean configure, then you can return to the INSTALL directions.



More information about the R-help mailing list