How To Update R In Ubuntu ?
4
7
Entering edit mode
11.0 years ago

i wanted to update my R version currently using 2.10. used the command sudo apt-get update R also tried with sudo apt-get upgrade R. both didnt work. please can you help to solve this....

r ubuntu • 208k views
ADD COMMENT
2
Entering edit mode

If the new version corresponds to the second digit. For instance, you want to update from 3.4 to 3.5:

  1. Go to the file: computer/etc/apt/sources.list
  2. Other Sortware
  3. Add
  4. deb http://www.icesi.edu.co/CRAN/bin/linux/ubuntu xenial-cran35/ <--- change "-cran35" for the current version according to "https://cran.r-project.org/bin/linux/ubuntu/"
  5. open the terminal (Ctrl+Alt+t)
  6. write on the terminal: sudo apt-get update
  7. Enter the password of your PC session
  8. write on the terminal: sudo apt-get install r-base
  9. Restart the computer

If the new version corresponds to the third digit. For instance, you want to update from 3.5.1 to 3.5.2:

  1. open the terminal (Ctrl+Alt+t)
  2. write on the terminal: sudo apt-get update
  3. Enter the password of your PC session
  4. write on the terminal: sudo apt-get install r-base
  5. Restart the computer

Additionally, maybe you need to update bioconductor and/or the packages. To do that:

Update bioconductor:

  1. Open R
  2. source("https://bioconductor.org/biocLite.R")
  3. biocLite("BiocUpgrade")

Update the packages

  1. open the terminal (Ctrl+Alt+t)
  2. sudo R
  3. update.packages()
  4. source("https://bioconductor.org/biocLite.R")
  5. biocLite()
ADD REPLY
24
Entering edit mode
11.0 years ago
HG ★ 1.2k

Here is the answer:

sudo su
echo "deb http://www.stats.bris.ac.uk/R/bin/linux/ubuntu precise/" >> /etc/apt/sources.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
apt-get update
apt-get upgrade
ADD COMMENT
4
Entering edit mode

Still worked Feb 7 2018

A simple notice :

sudo lsb_release -a      # to check the OS version

Will return Codename. My Ubuntu is 14.04, Codename is trusty.

So, original in the answer:

echo "deb http://www.stats.bris.ac.uk/R/bin/linux/ubuntu precise/" >> /etc/apt/sources.list

Now edit:

echo "deb http://www.stats.bris.ac.uk/R/bin/linux/ubuntu trusty/" >> /etc/apt/sources.list

Then go on in the same way :

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
apt-get update
apt-get upgrade
ADD REPLY
0
Entering edit mode

Thank you so much, it works in feb 2018 !

ADD REPLY
0
Entering edit mode

To my trusty update to R 3.6, just changed:

echo "deb http://www.stats.bris.ac.uk/R/bin/linux/ubuntu trusty-cran35/" >> /etc/apt/sources.list
ADD REPLY
1
Entering edit mode

This advice still worked 2016 April 17th.

ADD REPLY
1
Entering edit mode

A little more of detail that can be useful

echo "deb http://www.stats.bris.ac.uk/R/bin/linux/ubuntu precise/" >> /etc/apt/sources.list

This lane add as superuser the address of the repository of R into the end of the list of repositories that are used for Ubuntu's updates and upgrades. This address will work if you have the "precise" version of Ubuntu (that is version 12.04). It will not work, however, if you have a different Ubuntu version, as this name changes

For example, Ubuntu 15.04's name is "Vivid". Ubuntu 15.10's name is "Wily", and so on. You can know the name of your version by accessing to THIS WEB PAGE

For updates, most of the times this lane don't need to be added to the sources.list, but an editing of the sources.list is required instead. You can find that in a previous update, the lane defining a previous cran R repository has been deactivated by using a "#" . Use vi, pico, emacs, gedit or whatever your favorite editor is to change the name of the Ubuntu version, and erase the comment tag

Use the keyserver code only if it is needed or requested.

ADD REPLY
0
Entering edit mode

Still worked October 25 2016

ADD REPLY
0
Entering edit mode

Thank you!

Still worked 2017 March 29th (changing the version of Ubuntu & adding this cmd line) :

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1397BC53640DB551
echo "deb http://www.stats.bris.ac.uk/R/bin/linux/ubuntu trusty/" >> /etc/apt/sources.list

-->To determine the code name of the system you are running, open a terminal and use the command

lsb_release -a
ADD REPLY
0
Entering edit mode

Still worked in September 14 2017. The solution proposed in the CRAN website https://cran.r-project.org/bin/linux/ubuntu/README.html did not help me.

ADD REPLY
0
Entering edit mode

Still work till Oct 2017

ADD REPLY
0
Entering edit mode

Still work till Oct 2017

ADD REPLY
0
Entering edit mode

Thank you, still worked 2018 March 22nd

ADD REPLY
0
Entering edit mode

Thank you, still worked 2018 June 6nd

ADD REPLY
0
Entering edit mode

Still worked 2018 October 17th

ADD REPLY
0
Entering edit mode

Update R version (3.4 -> 3.5) in Ubuntu 16.04 (xenial):

sudo su 
echo "deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/" >> /etc/apt/sources.list 
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9 
apt-get update 
apt-get install r-base 
apt-get install r-base-dev
ADD REPLY
0
Entering edit mode

Worked 2019 April 17

ADD REPLY
0
Entering edit mode

Hello, I have tried this but I can't make it work. I checked my Ubuntu 18 LTS code name.

sudo lsb_release -a

Codename: bionic Then I followed this link ( http://www.stats.bris.ac.uk/R/bin/linux) and navigated until the folder that I though was correct. Then I did:

echo "deb http://www.stats.bris.ac.uk/R/bin/linux/ubuntu/bionic-cran35/" >> /etc/apt/sources.list

Followed by: apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9 Output

gpg: key 4359ED62E084DAB9: "Totally Legit Signing Key <mallory@example.org>" not changed

gpg: Total number processed: 1 gpg: unchanged: 1

When I run

apt-get update

I get

E: Malformed entry 56 in list file /etc/apt/sources.list (Suite)     
E: The list of sources could not be read.

I have check line 56 and it looks alright to me. Thank you very much

ADD REPLY
0
Entering edit mode

Made it work by deleting everything related to R first

rm -rf /usr/local/lib/R

I then used

sudo add-apt-repository "deb http://cran.rstudio.com/bin/linux/ubuntu $(lsb_release -sc)/"

and continued with the above protocol

ADD REPLY
0
Entering edit mode

Looks like the problem was that there should be a ' ' (space), not a '/' between "ubuntu" and "bionic-cran35"

ADD REPLY
0
Entering edit mode

Did not work April 2022. Used same code with my Ubuntu keyword (focal). Did not return any errors but my R version was unchanged:

r-base-dev is already the newest version (3.6.3-2).

Then I did what I should have done originally and checked the official R website. This worked: https://cloud.r-project.org/bin/linux/ubuntu/

ADD REPLY
3
Entering edit mode
11.0 years ago

Check this link

ADD COMMENT
1
Entering edit mode
11.0 years ago
Hamish ★ 3.3k

First check which version of R is supported for your Ubuntu using this link

From the package list it looks like you are using Ubuntu 10.04 LTS (Lucid Lynx), so you may want to upgrade to:

Or wait for the next LTS to become available, Ubuntu 14.04 (Trusty Tahr), in April 2014. The Ubuntu LTS releases are supported for five years, so you will want to upgrade soon in any case so you might want to get that out of the way.

If you want to try and upgrade your R packages then see 2.6 Are there Unix-like binaries for R? in the R FAQ for options.

ADD COMMENT

Login before adding your answer.

Traffic: 1661 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6