R and RStudio installation on Ubuntu 14.04 64-bit

Guide how can you install R and RStudio on Ubuntu linux and how to fix problems with JAVA libraries include problem with “rJava” package installation.

 RStudio      linux-java

[wp_ad_camp_1]

JAVA

Install Oracle JDK by this guide.
Note: Chapter “JAVA JDK 7”

 

R PPA repository

  1. Run terminal
  2. Create new file “r-base.list” by command
    sudo nano /etc/apt/sources.list.d/r-base.list
    
  3. Paste these lines into the file
    # R-Base repository
    deb http://mirrors.nic.cz/R/bin/linux/ubuntu trusty/
    
  4. Save and exit
  5. Import repository signature
    sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
    
  6. Update APT
    sudo apt-get update

 

Intall R

sudo apt-get install r-base r-base-dev r-cran-rjava r-cran-xml libxml2-dev

 

Install RStudio

Doanload and install RStudio from the web

 

[wp_ad_camp_1]

 

Fix R and RStudio issues with rJava package

  1. Open R running script
    sudo nano /usr/bin/R
    
  2. Add line below after first two lines of comments
    unset JAVA_HOME
    

    after your modification R file should starts with line

    #!/bin/bash
    # Shell wrapper for R executable.
    unset JAVA_HOME
    ...
    
  3. Move rstudio to new file rstudio-original
    sudo mv /usr/lib/rstudio/bin/rstudio /usr/lib/rstudio/bin/rstudio-original
    
  4. Create script rstudio
    sudo nano /usr/lib/rstudio/bin/rstudio
    
  5. Paste lines below to the file
    #!/bin/sh
    unset JAVA_HOME
    /usr/lib/rstudio/bin/rstudio-original $1
    
  6. Make rstudio file executable
    sudo chmod a+x /usr/lib/rstudio/bin/rstudio
    
  7. Run R JAVA reconfiguration by command
    sudo R CMD javareconf

 

Done, you can work on your scientific projects now. Enjoy it!

[wp_ad_camp_1]

Leave a Reply

Your email address will not be published. Required fields are marked *