我正在运行ubuntu并安装了Mongo 2.6.0。
最近出现了一个新的Mongo小版本(2.6.2),但出于某些原因我无法使用apt-get update && apt-get upgrade
升级到它(我记得在2.4.x版本时我正确升级了次要版本)
我认为我可以删除mongo并重新安装它,但这听起来并不吸引人。
我也知道这个问题不是编程本身,但我认为它对其他人有用,而且SO也有一个很好的mongo社区。 (但如果有人发现它真的偏离主题,请移动它)
以下是实际输出:
ubuntu@ip-10-34-23-80:~$ sudo apt-get update && sudo apt-get upgrade
Ign http://eu-west-1.ec2.archive.ubuntu.com trusty InRelease
Ign http://eu-west-1.ec2.archive.ubuntu.com trusty-updates InRelease
Hit http://eu-west-1.ec2.archive.ubuntu.com trusty Release.gpg
Hit http://eu-west-1.ec2.archive.ubuntu.com trusty-updates Release.gpg
Hit http://eu-west-1.ec2.archive.ubuntu.com trusty Release
Hit http://eu-west-1.ec2.archive.ubuntu.com trusty-updates Release
Hit http://eu-west-1.ec2.archive.ubuntu.com trusty/main Sources
Hit http://eu-west-1.ec2.archive.ubuntu.com trusty/universe Sources
Hit http://eu-west-1.ec2.archive.ubuntu.com trusty/main amd64 Packages
Hit http://eu-west-1.ec2.archive.ubuntu.com trusty/universe amd64 Packages
Hit http://eu-west-1.ec2.archive.ubuntu.com trusty-updates/main Sources
Hit http://eu-west-1.ec2.archive.ubuntu.com trusty-updates/universe Sources
Hit http://eu-west-1.ec2.archive.ubuntu.com trusty-updates/main amd64 Packages
Hit http://eu-west-1.ec2.archive.ubuntu.com trusty-updates/universe amd64 Packages
Ign http://security.ubuntu.com trusty-security InRelease
Get:1 http://security.ubuntu.com trusty-security Release.gpg [933 B]
Ign http://eu-west-1.ec2.archive.ubuntu.com trusty/main Translation-en_US
Ign http://eu-west-1.ec2.archive.ubuntu.com trusty/main Translation-en
Ign http://eu-west-1.ec2.archive.ubuntu.com trusty/universe Translation-en_US
Ign http://eu-west-1.ec2.archive.ubuntu.com trusty/universe Translation-en
Ign http://eu-west-1.ec2.archive.ubuntu.com trusty-updates/main Translation-en_US
Ign http://eu-west-1.ec2.archive.ubuntu.com trusty-updates/main Translation-en
Ign http://eu-west-1.ec2.archive.ubuntu.com trusty-updates/universe Translation-en_US
Ign http://eu-west-1.ec2.archive.ubuntu.com trusty-updates/universe Translation-en
Get:2 http://security.ubuntu.com trusty-security Release [58.5 kB]
Get:3 http://security.ubuntu.com trusty-security/main Sources [20.6 kB]
Get:4 http://security.ubuntu.com trusty-security/universe Sources [4,727 B]
Get:5 http://security.ubuntu.com trusty-security/main amd64 Packages [61.3 kB]
Get:6 http://security.ubuntu.com trusty-security/universe amd64 Packages [21.5 kB]
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Ign http://security.ubuntu.com trusty-security/main Translation-en_US
Ign http://security.ubuntu.com trusty-security/universe Translation-en_US
Fetched 168 kB in 2s (76.9 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
当我sudo apt-cache policy mongodb-org
时,我看不到有关2.6.2
版本的信息。
mongodb-org:
Installed: 2.6.0
Candidate: 2.6.0
Version table:
*** 2.6.0 0
100 /var/lib/dpkg/status
答案 0 :(得分:2)
将MongoDB更新到最新版本的正确命令是:
sudo apt-get install mongodb-org
您可以通过以下方式查看有关包及其版本的详细信息:
sudo apt-cache policy mongodb-org
它将显示如下内容:
mongodb-org:
Installed: 2.6.1
Candidate: 2.6.2
Version table:
2.6.2 0
500 http://downloads-distro.mongodb.org/repo/ubuntu-upstart/ dist/10gen amd64 Packages
*** 2.6.1 0
500 http://downloads-distro.mongodb.org/repo/ubuntu-upstart/ dist/10gen amd64 Packages
100 /var/lib/dpkg/status
2.6.0 0
500 http://downloads-distro.mongodb.org/repo/ubuntu-upstart/ dist/10gen amd64 Packages
来自MongoDB存储库的软件包的先前名称是mongodb-10gen
,但它已重命名为mongodb-org
。
如果您尝试使用以下代码安装mongo
包
sudo apt-get install mongodb
它将尝试从Ubuntu存储库(更旧版本)安装MongoDB。
请务必检查官方installation page以了解其回购地点等的更新。
修改强>
您的软件包似乎是从deb软件包手动安装的,或者MongoDB repo已从apt来源列表中删除。
无论哪种方式,将MongoDB repo添加回源列表然后执行:
sudo apt-get update && sudo apt-get install mongodb-org
将安装最新版本的MongoDB(仅供参考,链接至official installation docs)。