How to install R 4.0 on Ubuntu 18.04 when 'r-base' has no installation candidate

Solution 1:

Following suggestion by @user.dz, I ended up manually editing /etc/apt/preferences and replacing pin priority from -1 to 500

Package: *
Pin: release a=bionic*
Pin-Priority: 500

Solution 2:

The Problem is :

$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
  Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
  Executing: /tmp/apt-key-gpghome.D7jTjWc4gW/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
  gpg: key 51716619E084DAB9: "Michael Rutter <[email protected]>" 1 new signature
  gpg: Total number processed: 1
  gpg:         new signatures: 1     

When you run apt-key the keyserver is deprecated on /tmp/ like my case. The Ubuntu archives on CRAN are signed with the key of Michael Rutter [email protected] with key ID 0x51716619e084dab9. To add the key to your system with one command use

Recommended method :

$ wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc
$ sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"
$ sudo apt update
$ sudo apt install --no-install-recommends r-base     

Hope this helps.

Related

  • https://cran.r-project.org/
  • https://cran.r-project.org/bin/linux/ubuntu/fullREADME.html