MongoDB error on Ubuntu 20.04 LTS: GPG error: http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.4 Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 

Reading Time: < 1 minute

This is a common error when you install MongoDB due to failed key verification.

To fix this run the following command:

/usr/bin/curl -sLO https://www.mongodb.org/static/pgp/server-4.4.asc && sudo /usr/bin/apt-key add server-4.4.asc

The 4.4 in the command above refers to the database version. You may change it to the version you are actually installing.

Then run:

sudo apt-get update

Now you may install MongoDB by running:

sudo apt-get install -y mongodb-org

Start the MongoDB once it is installed:

sudo systemctl start mongod

Check if its running using this command:

sudo systemctl status mongod

Leave a Reply