Installing R from CRAN Ubuntu repository: No Public Key Error

Solution 1:

The simplest solution that worked for me was from Emre Sahin in this thread:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9 

Solution 2:

Like @Ben Bolker commented (sorry I hijacked your commented, but the correct answer was not yet posted), in the description of the debian package repo there is a section secure apt which says:

SECURE APT

The Debian backports archives on CRAN are signed with the key of "Johannes Ranke (CRAN Debian archive) " with key ID 381BA480. You can fetch this with

gpg --keyserver subkeys.pgp.net --recv-key 381BA480 or alternatively, using another key server,

gpg --keyserver pgp.mit.edu --recv-key 381BA480 If this doesn't work, it might be due to a firewall blocking port 11371. Alternatively, you can search for 0x381BA480 at http://keyserver.noreply.org/ or http://pgp.mit.edu/ and copy the key block into a plain text file, named, for instance, jranke_cran.asc.

If receiving the key with gpg did work, you need to export it to a text file

gpg -a --export 381BA480 > jranke_cran.asc In both cases you need to make the key known to the apt system by running

apt-key add jranke_cran.asc as root.

If you have not already done this, this will probably fix your issue.

Solution 3:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys KEYID

and replace KEYID with the number shown in the error message.

Solution 4:

Thanks to Philipp Burckhardt, I got it fixed.

Try this:

gpg --keyserver pgpkeys.mit.edu --recv-key 51716619E084DAB9  
gpg -a --export 51716619E084DAB9 | sudo apt-key add -