7C00.ME/houmu 2014-10-05

Install R From the Source Code on Ubuntu

R can be installed by apt-get on Ubuntu systems. This is the official suggestion. See here. I would install R from the source code for some personal reasons, one of which is that I prefer to leave the executable files with my $HOME directory rather than the system scope, to mitigate the side effect on my system.

The official guide on installing R is R installation and Administration, which is really long. Following is the main steps I took on Ubuntu 14.04:

# get the source code
mdkir -p $HOME/bin/R/src
cd $HOME/bin/R/src
wget "http://cran.r-project.org/src/base/R-3/R-3.1.1.tar.gz"
tar zxf R-3.1.1.tar.gz
cd R-3.1.1/

# build
sudo apt-get install xorg-dev texinfo
./configure LIBnn=lib --prefix=$HOME/bin/R/R-3.1.1 \
    --host=x86_64-pc-linux-gnu \
        --enable-R-shlib \
            make check
            make install

# configure
# append the code below to $HOME/.bashrc or $HOME/.bash_profile
export R_HOME=$HOME/bin/R/R-3.1.1
export PATH=$R_HOME/bin:$PATH

Most of the code is easy to understand. In addtion, sudo apt-get install xfstt xfonts-100dpi xfonts-75dpi and reboot would help you to avoid some problems on fonts when you use rstudio.