【问题标题】:How can I upgrade my 2.6.0 mongo to 2.6.latest?如何将我的 2.6.0 mongo 升级到 2.6.latest?
【发布时间】:2014-06-20 17:22:03
【问题描述】:

我正在运行 ubuntu 并安装了 Mongo 2.6.0。

最近出现了一个新的 Mongo 次要版本(2.6.2),但由于某种原因,我无法使用 apt-get update && apt-get upgrade 升级到它(我记得在 2.4.x 版本上正确升级了次要版本)。

我认为我可以删除 mongo 并重新安装它,但这听起来并不吸引人。

我也知道这个问题本身不是编程,但我认为它对其他人有用,而且 SO 有一个很好的 mongo-community。 (但如果有人觉得它真的跑题了,请移动它)

这是实际输出:

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

【问题讨论】:

  • 我认为您在应用升级时可能打开了外壳或其他东西。我以前做过。退出所有工具,也许只是尝试重新安装“工具”包,或者只是再次处理安装。在后一种情况下先删除。
  • 感谢@NeilLunn,我有我的开发机器和 2 台服务器,并尝试了几次 apt-get。它更新了很多东西,但不是 mongo。所有环境中的情况都是一样的。
  • 我的意思是你知道它没有更新怎么办?只是通过shell的提示吗?还是日志中的服务器版本报告不会更改?尝试运行 apt-get upgrade 的输出是什么?这是否甚至表明包裹已被提取或是否有错误?我假装你在谈论你的开发环境,所以这不是题外话,但你真的可以在你的问题中涵盖更多内容。还要看看所有这些东西,它们都有日志。
  • 我在终端输入sudo apt-...。它寻找可能的更新,找不到与 mongo 相关的任何内容,仅此而已。我在问题中添加了实际输出。
  • 试试apt-get install mongodb 作为一个命令。确保您已删除任何 mongodb-10gen 软件包,并且您应该拥有的唯一软件包是 mongodb-org。还要查看您的 apt-get 历史记录,例如 less /var/log/apt/history.log,以防之前出现问题。

标签: mongodb


【解决方案1】:

将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 以了解其 repo 位置等的更新。

编辑

您的软件包似乎是从 deb 软件包手动安装的,或者 MongoDB 存储库已从 apt 源列表中删除。

无论哪种方式,将 MongoDB 存储库添加回源列表,然后执行:

sudo apt-get update && sudo apt-get install mongodb-org

将安装最新版本的MongoDB(仅供参考,链接official installation docs)。

【讨论】:

  • 感谢您的回答。由于某种原因,我在执行 apt-cache 策略时看不到 2.6.2 版本。请检查我更新的问题。
  • 谢谢克里斯蒂安。我会尝试你的建议+1。问题是我肯定没有从二进制安装。但谁知道呢,可能是我忘记了。
  • @SalvadorDali - 对不起,我的意思是 .deb 包。
猜你喜欢
  • 2020-11-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-01-04
  • 2019-02-01
  • 2018-04-05
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多