当我尝试使用https://docs.mongodb.com/getting-started/shell/tutorial/install-mongodb-on-ubuntu/
16.04 上的说明安装mongodb时,在安装步骤中得到以下结果:
jonathan@poseidon:~$ sudo apt-get install mongodb-org
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package mongodb-org is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'mongodb-org' has no installation candidate
我使用Wireshark检查了HTTP流量,发现唯一的流量是列表的HTTP GET和HTTP 304响应,这表明问题出在我的本地配置文件中。我的sources.list.d文件包含以下条目:
mongodb-org-3.4.list
我需要怎么做才能继续解决此问题?
编辑:我试图在VirtualBox下的16.04的新安装上再次执行此操作。我检索了密钥,创建了列表文件,并sudo apt update
得到了以下结果:
jonathan@Ubuntu-16:~$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
[sudo] password for jonathan:
Executing: /tmp/tmp.uWYpRUWfjK/gpg.1.sh --keyserver
hkp://keyserver.ubuntu.com:80
--recv
0C49F3730359A14518585931BC711F9BA15703C6
gpg: requesting key A15703C6 from hkp server keyserver.ubuntu.com
gpg: key A15703C6: public key "MongoDB 3.4 Release Signing Key <packaging@mongodb.com>" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
jonathan@Ubuntu-16:~$ echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse
jonathan@Ubuntu-16:~$ sudo apt update
Ign:1 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 InRelease
Get:2 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 Release [3 462 B]
Hit:3 http://mx.archive.ubuntu.com/ubuntu xenial InRelease
Get:4 http://security.ubuntu.com/ubuntu xenial-security InRelease [94.5 kB]
Get:5 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 Release.gpg [801 B]
Get:6 http://mx.archive.ubuntu.com/ubuntu xenial-updates InRelease [95.7 kB]
Ign:5 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 Release.gpg
Get:7 http://mx.archive.ubuntu.com/ubuntu xenial-backports InRelease [92.2 kB]
Reading package lists... Done
W: GPG error: http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY D68FA50FEA312927
E: The repository 'http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 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.
jonathan@Ubuntu-16:~$
如您所见,检索到的密钥用于Mongodb 3.4,而不是Mongodb 3.2,这解释了apt更新中的GPG失败。有人知道从哪里获得正确的密钥吗?