警告:apt-key 已弃用。请改为在 trust.gpg.d 中管理密钥环文件(请参阅 apt-get(8))

警告:apt-key 已弃用。请改为在 trust.gpg.d 中管理密钥环文件(请参阅 apt-get(8))

我遵循指南https://docs.hazelcast.com/hazelcast/latest/getting-started/quickstart.html

wget -qO - https://repository.hazelcast.com/api/gpg/key/public
sudo apt-key add - echo "deb https://repository.hazelcast.com/debian stable main"
sudo tee -a /etc/apt/sources.list
sudo apt update && sudo apt install hazelcast=5.1.1

在此处输入图片描述

错误

Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-get(8)).

如何克服这个问题?

答案1

apt-key 现在似乎已被弃用,我已经创建了一个脚本,可以检测并获取丢失的密钥,你可以获取它这里

#!/bin/sh -e
tmp="$(mktemp)"
sudo apt-get update 2>&1 | sed -En 's/.*NO_PUBKEY ([[:xdigit:]]+).*/\1/p' | sort -u > "${tmp}"
cat "${tmp}" | xargs sudo gpg --keyserver "hkps://keyserver.ubuntu.com:443" --recv-keys  # to /usr/share/keyrings/*
cat "${tmp}" | xargs -L 1 sh -c 'sudo gpg --yes --output "/etc/apt/trusted.gpg.d/$1.gpg" --export "$1"' sh  # to /etc/apt/trusted.gpg.d/*
rm "${tmp}"

相关内容