I'm installing MongoDB on an Ubuntu 14.04 machine, using the instructions at: https://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
So I run:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
And then:
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
Followed by:
sudo apt-get update
I then get the following warning at the end of the update:
W: GPG error: http://repo.mongodb.org trusty/mongodb-org/3.2 Release: The following signatures were invalid: BADSIG D68FA50FEA312927 MongoDB 3.2 Release Signing Key
If I ignore the warning and try to run:
sudo apt-get install -y mongodb-org
I get:
WARNING: The following packages cannot be authenticated!
mongodb-org-shell mongodb-org-server mongodb-org-mongos mongodb-org-tools mongodb-org E: There are problems and -y was used without --force-yes
Any ideas on how to resolve? Thanks!
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.