You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

关于替代已弃用apt-key安装Microsoft Edge的GPG密钥配置疑问

替代已弃用apt-key安装Microsoft Edge的GPG密钥配置疑问

Hey there! Let's break this down clearly to get rid of your confusion about replacing the deprecated apt-key method for setting up Microsoft Edge's GPG keys.

First, a quick context: The old wget ... | sudo apt-key add - approach is deprecated because it adds the GPG key to the global trusted.gpg store. This is a security risk since it makes your system trust that key for all APT repositories, not just the one it's meant for. The new recommended method stores keys in individual files under /etc/apt/trusted.gpg.d/, which ties each key to a specific repository and keeps things more secure and manageable.

Now, adapting the curl command you saw for Spotify to Microsoft Edge is straightforward. Here's the correct command to use:

curl -sS https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/microsoft.gpg > /dev/null

Let's unpack what each part does:

  • curl -sS https://packages.microsoft.com/keys/microsoft.asc: Downloads Microsoft's public GPG key quietly (without extra output)
  • gpg --dearmor: Converts the ASCII-formatted key into a binary GPG file format, which modern APT prefers
  • sudo tee /etc/apt/trusted.gpg.d/microsoft.gpg: Writes the binary key to a file named microsoft.gpg in the trusted.gpg.d directory.

To answer your specific question:

  • If the microsoft.gpg file doesn't exist yet (which is the case for most first-time setups), tee will create it for you.
  • If the file already exists, tee will overwrite it by default. This is usually fine if you're updating to the latest key, but just keep that in mind if you had an older version stored there.

Once you've added the key this way, you can proceed to add Microsoft Edge's APT repository (usually something like deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main in /etc/apt/sources.list.d/microsoft-edge.list) and run sudo apt update to install Edge safely.

备注:内容来源于stack exchange,提问作者Nicholas Saunders

火山引擎 最新活动