7

R released an upgrade to version 4.0 about two weeks ago. I am trying to update R on my ubuntu 18.04 work station (sudo apt install r-base), but I am told that "r-base is already the newest version (3.6.3-1bionic)". But that isn't the newest version. How can I get the installer for R 4.0? Larry Hunsicker

In response to N0rbert's request:

larry@VUbuntu15:~$ apt-cache policy r-base-dev r-base-dev: Installed: (none) Candidate: 4.0.0-1.2004.0 Version table: 4.0.0-1.2004.0 500 500 https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/ Packages 3.6.3-1bionic 500 500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages 3.6.2-1bionic 500 500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages 3.6.1-3bionic 500 500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages 3.6.1-1bionic 500 500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages 3.6.0-2bionic 500 500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages 3.6.0-1bionic 500 500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages 3.5.3-1bionic 500 500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages 3.5.2-1bionic 500 500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages 3.5.1-2bionic 500 500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages 3.5.1-1bionic 500 500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages 3.5.0-1bionic 500 500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages 3.4.4-1ubuntu1 500 500 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages 500 http://us.archive.ubuntu.com/ubuntu bionic/universe i386 Packages 500 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages 500 http://archive.ubuntu.com/ubuntu bionic/universe i386 Packages larry@VUbuntu15:~$ grep -r r-project /etc/apt --include="*.list" /etc/apt/sources.list:deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ /etc/apt/sources.list:deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/

2

2 Answers 2

19

To answer your questions

Ubuntu usually packages software versions that are the ones that they tested, so when they are going to do a Ubuntu release, they get all stable packages one day and after that, they start testing all the packages so they ensure good reliability so they don't update those packages in their repos, that's way you won't get latest packaged inside ubuntu's repos

and for installing latest versions of some packages you could add repos, download snaps or just rely on the good old deb

here is how you can download latest R

First, you should run: this will remove R

$ sudo apt remove r-base

then type this, so you can add the GPG Key

$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9

Now add this repo

$ sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/'

then update your packages list

$ sudo apt update

now install R

$ sudo apt install r-base

Here is the link to cran project and the manual for ubuntu instalation

3
  • Bless you, Giovanni! That worked. I now have R 4.0. Commented May 9, 2020 at 12:05
  • I'm glad, bless you too! Commented May 11, 2020 at 20:37
  • Use focal-cran40 instead of bionic-cran40 if your Ubuntu's codename is focal.
    – 3N4N
    Commented Sep 14, 2021 at 14:22
3

If you are upgrading from R 3, you need to remove the old R 3.5 repository before adding the new R 4.0 repository and installing it:

sudo apt remove r-base
sudo add-apt-repository -r 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/'
sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/'
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install r-base r-base-core r-recommended

Reference

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .