I have been following the instructions to upgrade the MongoDB server from 6 to 7 from the official page. Then I tried to install version 7 according to this. When I run sudo apt-get update, I am getting the following error:
Hit:1 http://us-east-1.ec2.archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 http://us-east-1.ec2.archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:3 http://us-east-1.ec2.archive.ubuntu.com/ubuntu jammy-backports InRelease
Hit:4 https://deb.nodesource.com/node_16.x focal InRelease
Ign:5 https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 InRelease
Hit:6 http://security.ubuntu.com/ubuntu jammy-security InRelease
Get:7 https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 Release [2090 B]
Get:8 https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 Release.gpg [866 B]
Ign:8 https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 Release.gpg
Reading package lists... Done
W: GPG error: https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 160D26BB1785BA38
E: The repository 'https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 Release' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
My keyring is in place in this file: /usr/share/keyrings/mongodb-server-7.0.gpg
One thing I found was the keyring is not showing when running sudo apt-key list. No matter how many times I run the curl -fsSL https://pgp.mongodb.com/server-7.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg --dearmor command, the key ring doesn’t show up there but the file is created.