MongoDB GPG - Invalid Signatures
Update all expired keys from Ubuntu key server in one command:
sudo apt-key list | \
grep "expired: " | \
sed -ne 's|pub .*/\([^ ]*\) .*|\1|gp' | \
xargs -n1 sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys
Command explanation:
sudo apt-key list
- lists all keys installed in the system;grep "expired: "
- leave only lines with expired keys;sed -ne 's|pub .*/\([^ ]*\) .*|\1|gp'
- extracts keys;xargs -n1 sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys
- updates keys from Ubuntu key server by found expired ones.
Source
Sounds like you need to redo the installation steps for MongoDB. First, remove any existing repository file for MongoDB. Do as below:
$ sudo rm /etc/apt/sources.list.d/mongodb*.list
Next, add the key (without the key, the repository will not load):
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
Now, create a new MongoDB repository list file:
$ echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
After adding the repository details, we need to update the packages list:
$ sudo apt-get update
Now install MongoDB:
sudo apt install mongodb-org