Ubuntu20.04安装InfluxDB2时遭遇签名验证问题求助
InfluxDB2在Ubuntu20.04安装时的签名错误及解决方法
问题现象
按照步骤在Ubuntu20.04上安装InfluxDB2时,执行apt-get update提示缺少公钥NO_PUBKEY D8FF8E1F7DF8B07E,仓库未签名无法安全更新;执行apt-get install influxdb2时提示找不到该包。具体操作及错误输出如下:
/home/ravi>sudo su /home/ravi#wget -qO- https://repos.influxdata.com/influxdb.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/influxdb.gpg > /dev/null gpg: WARNING: unsafe ownership on homedir '/home/ravi//.gnupg' /home/ravi#export DISTRIB_ID=$(lsb_release -si); export DISTRIB_CODENAME=$(lsb_release -sc) /home/ravi#echo "deb [signed-by=/etc/apt/trusted.gpg.d/influxdb.gpg] https://repos.influxdata.com/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" | sudo tee /etc/apt/sources.list.d/influxdb.list > /dev/null /home/ravi#apt-get update Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB] Hit:3 http://in.archive.ubuntu.com/ubuntu focal InRelease Get:4 https://repos.influxdata.com/ubuntu focal InRelease [7,019 B] Get:5 http://in.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB] Err:4 https://repos.influxdata.com/ubuntu focal InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY D8FF8E1F7DF8B07E Hit:2 https://packages.cloud.google.com/apt kubernetes-xenial InRelease Get:6 http://in.archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB] Get:7 http://security.ubuntu.com/ubuntu focal-security/main amd64 DEP-11 Metadata [60.0 kB] Get:8 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [275 kB] Get:9 http://security.ubuntu.com/ubuntu focal-security/universe i386 Packages [588 kB] Get:10 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 DEP-11 Metadata [409 kB] Get:11 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [812 kB] Get:12 http://security.ubuntu.com/ubuntu focal-security/universe amd64 DEP-11 Metadata [94.7 kB] Get:13 http://in.archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 DEP-11 Metadata [944 B] Get:14 http://in.archive.ubuntu.com/ubuntu focal-backports/main amd64 DEP-11 Metadata [7,992 B] Get:15 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 DEP-11 Metadata [940 B] Get:16 http://in.archive.ubuntu.com/ubuntu focal-backports/universe amd64 DEP-11 Metadata [30.5 kB] Reading package lists... Done W: GPG error: https://repos.influxdata.com/ubuntu focal InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY D8FF8E1F7DF8B07E E: The repository 'https://repos.influxdata.com/ubuntu focal 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. /home/ravi#apt-get install influxdb2 Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package influxdb2 /home/ravi#
解决步骤
1. 手动添加缺失的GPG公钥
执行以下命令获取并导入缺失的公钥:
gpg --keyserver keyserver.ubuntu.com --recv-keys D8FF8E1F7DF8B07E gpg --export D8FF8E1F7DF8B07E | sudo tee /etc/apt/trusted.gpg.d/influxdb-official.gpg > /dev/null
2. 修复源列表配置
检查InfluxDB源列表文件内容是否正确,执行:
cat /etc/apt/sources.list.d/influxdb.list
确保文件内容为:
deb [signed-by=/etc/apt/trusted.gpg.d/influxdb-official.gpg] https://repos.influxdata.com/ubuntu focal stable
如果内容不符,重新创建源列表:
echo "deb [signed-by=/etc/apt/trusted.gpg.d/influxdb-official.gpg] https://repos.influxdata.com/ubuntu focal stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
3. 修复.gnupg目录权限(解决GPG警告)
之前操作中出现的unsafe ownership on homedir警告,可通过以下命令修复:
sudo chown -R ravi:ravi /home/ravi/.gnupg sudo chmod 700 /home/ravi/.gnupg
4. 重新更新并安装InfluxDB2
执行更新命令确认无签名错误后,安装InfluxDB2:
sudo apt-get update sudo apt-get install influxdb2
内容的提问来源于stack exchange,提问作者myquest5 sh
相关产品推荐
相关产品推荐

