尝试在Ubuntu20.04上安装ROS,按照安装教程写到sudo apt update这一步时,出现报错
W: GPG error: http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu focal Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F42ED6FBAB17C654
E: The repository 'http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu focal Release' 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.
写入以下命令行后,再输入sudo apt update,发现可以正常执行
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
该命令用于将 GPG 密钥添加到系统的 APT 密钥环中,通常用于信任软件源中的软件包签名。
其中,
sudo:
以超级用户权限执行命令。apt-key
:用于管理 APT 软件包管理系统中使用的 GPG 密钥。adv
:是--advanced
的缩写,表示使用高级模式。--keyserver keyserver.ubuntu.com
:指定 GPG 密钥服务器,这里是 Ubuntu 的密钥服务器。--recv-keys C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
:用于从指定的密钥服务器接收并导入指定的 GPG 密钥,C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
是密钥的 ID,根据你所需的密匙ID去调整指令。