安装R语言时报错:W: GPG error: https://cloud.r-project.org/bin/linux/ubuntu artful/

你在这里

安装R语言时报错:W: GPG error: https://cloud.r-project.org/bin/linux/ubuntu artful/

安装R语言,文件/etc/apt/sources.list中添加了如下deb路径后:
deb https://cloud.r-project.org/bin/linux/ubuntu xenial/
运行sudo apt-get update报如下错误:
W: GPG error: https://cloud.r-project.org/bin/linux/ubuntu artful/ Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 51716619E084DAB9
E: The repository 'https://cloud.r-project.org/bin/linux/ubuntu xenial/ InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

  •  

回答

这是因为CRAN中存储的Ubuntu包需要通过密钥51716619E084DAB9进行签名验证。
因此需要运行以下命令添加密钥到ubuntu系统:

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