Fix missing key issue for Slack APT repo in Debian/Ubuntu

If you are using Debian/Ubuntu, having Slack installed, you will see this warning when doing apt update:

W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://packagecloud.io/slacktechnologies/slack/debian jessie InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY C6ABDCF64DB9A0B2
W: Failed to fetch https://packagecloud.io/slacktechnologies/slack/debian/dists/jessie/InRelease  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY C6ABDCF64DB9A0B2
W: Some index files failed to download. They have been ignored, or old ones used instead.

Here is how to fix:

  1. Use GPG to retrieve Slack public key:
$ gpg --keyserver pgpkeys.mit.edu --recv-key C6ABDCF64DB9A0B2              
gpg: key D938EC0D038651BD: public key "https://packagecloud.io/slacktechnologies/slack (https://packagecloud.io/docs#gpg_signing) <support@packagecloud.io>" imported
gpg: Total number processed: 1
gpg:               imported: 1
  1. Export that key to a file, storing it to a place where APT can use
gpg --export C6ABDCF64DB9A0B2 | sudo tee /etc/apt/keyrings/slack.gpg
  1. Open /etc/apt/sources.list.d/slack.list file, which was added automatically when you installed Slack from deb file, modify the line to be like this:
deb [signed-by=/etc/apt/keyrings/slack.gpg] https://packagecloud.io/slacktechnologies/slack/debian/ jessie main

(we add [signed-by=...])

Now, run sudo apt update again, you won't see that warning message.