我正在尝试安装(不是我选择的)Microsoft Windows Defender。为此,我需要添加一个存储库密钥:
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add –
但这不再起作用了。我做了以下操作来获取文件:
curl https://packages.microsoft.com/keys/microsoft.asc -o /usr/local/share/keyrings/microsoft_windows_defender.key
我检查了文件:
file usr/local/share/keyrings/microsoft_windows_defender.key
返回:
PGP public key block Public-Key (old)
然后我创建了源文件
nano /etc/apt/sources.list.d/microsoft-prod.list
包含:
deb [arch=amd64,armhf,arm64 signed-by=/usr/share/keyrings/microsoft_windows_defender.gpg] https://packages.microsoft.com/ubuntu/22.04/prod jammy main
但是当我跑的时候
apt update
它给出了一个错误:
https://packages.microsoft.com/ubuntu/22.04/prod jammy InRelease: NO_PUBKEY EB3E94ADBE1229CF
有人能帮忙解决这个问题吗?谢谢。
答案1
从https://itsfoss.com/apt-key-deprecated/
必须以二进制格式解密并添加密钥。
$ curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | sudo tee /usr/share/keyrings/microsoft_windows_defender.gpg
$ echo " deb [signed-by=/usr/share/keyrings/microsoft_windows_defender.gpg arch=amd64,armhf,arm64] https://packages.microsoft.com/ubuntu/22.04/prod jammy main" | sudo tee /etc/apt/sources.list.d/microsoft-prod.list
$ sudo apt update