Retrieving gpg key failed during yum install on amazon linux

Configuration from here (version 6.0):

command:
sudo yum install -y mongodb-org

result:
GPG key retrieval failed: [Errno 12] Timeout on https://www.mongodb.org/static/pgp/server-6.0.asc: (28, ‘Failed to connect to www mongodb org port 443 after 4376 ms: Connection timed out’)

Download works without any issues on my browser.
Also yum in general works perfectly, mongodb repository is only one failing.
It is very weird everything else seems to work. Possibly it is something unrelated to mongodb.org but I can’t figure out what.

You can disable GPG key on the added repo, by inserting 0 instead of 1 as shown below,

vi /etc/yum.repos.d/mongodb-org-7.0.repo

[mongodb-org-8.0]
name=MongoDB Repository
baseurl=MongoDB Repositories
gpgcheck=0
enabled=1
gpgkey=https://pgp.mongodb.com/server-8.0.asc

or you can import gpg following,

sudo rpm --import https://www.mongodb.org/static/pgp/server-8.0.asc

1 Like