Friday, February 12, 2016

Install R very latest or current version in Ubuntu Linux

We may not be able to install the latest version R, when we install R through Software centre in Ubuntu. The following code is useful to install R latest version through terminal in Ubuntu.

1. First try to save the codename of Ubuntu by doing below in terminal.

codename=$(lsb_release -c -s)

Alternatively you can also try
lsb_release -c -s

to know the release name of Ubuntu in Terminal. What we are doing is that we are trying to save the version name in an object "codename", which we will use to update software sources.

2. Now update the software sources list by doing

echo "deb http://ftp.iitm.ac.in/cran/bin/linux/ubuntu $codename/" | sudo tee -a /etc/apt/sources.list > /dev/null  

Now you can open /etc/apt/sources.list through any text editor you may be able to find new line "deb http://ftp.iitm.ac.in/cran/bin/linux/ubuntu $codename/". You can use any other mirror of your interest. For CRAN mirrors please visit https://cran.r-project.org/mirrors.html.

3. Retrieve the apt key and add the apt-repository of R to the key-server.

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9  
sudo add-apt-repository ppa:marutter/rdev


4. Update R by doing the below stepts.

sudo apt-get update  
sudo apt-get upgrade  
sudo apt-get install r-base r-base-dev

That's all you should be able to get new R version.

No comments:

Post a Comment