21 June 2017

How to install R 3.4.0 and R Studio on a Ubuntu 16.04 installation.

I spent a lot of time today setting up my Ubuntu 16.04 virtual machine and its corresponding new R and R Studio installation. I’m sharing what I did to have an operational installation because it could save a lot of time for someone wanting to accomplish the same thing.

First, install the Ubuntu 16.04 OS. Then follow these commands:

# Install all dependencies
sudo apt-get install build-essential
sudo apt-get install fort77
sudo apt-get install xorg-dev
sudo apt-get install liblzma-dev  libblas-dev gfortran
sudo apt-get install gcc-multilib
sudo apt-get install gobjc++
sudo apt-get install aptitude
sudo aptitude install libreadline-dev
sudo aptitude install libcurl4-openssl-dev
sudo apt-get install default-jdk
sudo apt-get install texlive-latex-base
sudo apt-get install libcairo2-dev 

# Install r-base with ubuntu
sudo apt-get install r-base

# Install newest version of R from source
 wget https://cran.r-project.org/src/base/R-3/R-3.4.0.tar.gz
./configure --prefix=/home/jtrembla/software/R/R-3.4.0 --with-x=yes --enable-R-shlib=yes --with-cairo=yes
make
# NEWS.pdf file is missing and will make installation crash.
touch doc/NEWS.pdf
make install

# Do not forget to update your PATH
export PATH=~/software/R/R-3.4.0/bin:$PATH
export RSTUDIO_WHICH_R=~/software/R/R-3.4.0/bin/R

# Install libjpeg62
sudo apt-get install libjpeg62
# for some reason it prompted me to do 'sudo apt-get -f install' after. I did and it worked...

# Download Rstudio and install it.
wget https://download1.rstudio.org/rstudio-1.0.143-amd64.deb
sudo dpkg -i rstudio-1.0.143-amd64.deb

## for rJava and ReporteRs installation you also need to do this:
sudo apt-get install libxml2-dev
sudo R CMD javareconf

## install fonts as well.
sudo apt-get install t1-xfree86-nonfree ttf-xfree86-nonfree ttf-xfree86-nonfree-syriac xfonts-75dpi xfonts-100dpi


# That's it type rstudio and all should be good!

Here, after installation of t1-xfree86-nonfree etc, I had to restart my VM (Ubuntu) otherwise, R would give me an error saying that some helvetica font was missing… It should all work good. I might have forgotten to include some steps, but it should be complete.



blog comments powered by Disqus