2014-06-20 56 views
1

我正在運行ubuntu並安裝了Mongo 2.6.0。如何將2.6.0 mongo升級到2.6.latest?

最近出現了一個新的小版本的Mongo(2.6.2),但出於某種原因,我無法通過apt-get update && apt-get upgrade升級到它(我記得我在2.4.x版本時正確升級了小版本)。

我認爲我可以刪除mongo並重新安裝它,但這聽起來不太吸引人。

另外我知道這個問題本身不是編程,但我認爲這對其他人很有用,而且SO也有很好的mongo社區。 (但是,如果有人發現了它真正的題外話,請移動它)

下面是實際的輸出:

[email protected]:~$ 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

我想你應用升級時可能有一個外殼或東西打開。我以前做過。退出所有工具,也許只是嘗試重新安裝「工具」包,否則只是再次安裝。在後一種情況下先取下。 –

+0

謝謝@NeilLunn,我有我的開發機器和2臺服務器,並嘗試過幾次。它更新了很多東西,但不是mongo。所有的環境也是如此。 –

+0

我得到的是你知道它沒有更新如何?它只是由shell提示嗎?或者日誌中的服務器版本報告不能更改?試圖運行apt-get升級的輸出是什麼?這是否甚至表示包被提取或有錯誤?我假裝你在談論你的開發環境,所以這不是主題,但你可以真正涵蓋更多的問題。也看看所有這些東西,都有日誌。 –

回答

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的回購從取出apt源列表。

無論哪種方式,加入了MongoDB的回購回源列表,然後做:

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

將安裝MongoDB的最新版本(僅供參考,鏈接official installation docs)。

+0

感謝您的回答。出於某種原因,當我執行apt-cache策略時,我看不到2.6.2版本。請檢查我更新的問題。 –

+0

@SalvadorDali查看我的更新 –

+0

謝謝Christian。我會嘗試你的建議+1。問題是我絕對沒有從二進制安裝。但誰知道,可能我忘了。 –