Ubuntu 上安装了哪个版本的 MongoDB
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19405791/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What version of MongoDB is installed on Ubuntu
提问by RachelD
Hi I'm a bit of a shell n00b.
嗨,我有点像壳 n00b。
Can anyone tell me how I would check the version of MongoDB that is installed on my Linux Ubuntu machine?
谁能告诉我如何检查我的 Linux Ubuntu 机器上安装的 MongoDB 版本?
I see that my MongoDB shell version: 1.2.2 so Im pretty sure that MongoDB itself is out dated too. And does anyone know of any 'How to update MongoDB' docs? I find mongodb.org to be a bit confusing.
我看到我的 MongoDB shell 版本:1.2.2 所以我很确定 MongoDB 本身也已经过时了。有谁知道任何“如何更新 MongoDB”的文档?我发现 mongodb.org 有点混乱。
Please and thank you.
谢谢,麻烦您了。
Ok if I use db.version() inside of mongo shell it says 1.2.2
好的,如果我在 mongo shell 中使用 db.version() 它说 1.2.2
If I $ mongod --version I get this:
如果我 $ mongod --version 我得到这个:
db version v1.2.2, pdfile version 4.5
Wed Oct 16 10:28:22 git version: nogitversion
I ran
我跑了
sudo apt-get update
sudo apt-get install mongodb
and get
并得到
sudo apt-get install mongodb
Reading package lists... Done
Building dependency tree
Reading state information... Done
mongodb is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 179 not upgraded.
mongod --version
db version v1.2.2, pdfile version 4.5
Wed Oct 16 10:31:07 git version: nogitversion
So why isn't it updating? Is apt-get pointing at the wrong repo / source?
那为什么不更新呢?apt-get 是否指向错误的存储库/源?
采纳答案by RachelD
ANSWER: Read the instructions #dua
答案:阅读说明#dua
Ok the magic was in this line that I apparently missed when installing was:
好吧,我在安装时显然错过了这一行的魔力是:
$ sudo apt-get install mongodb-10gen=2.4.6
And the full process as described here http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/is
此处描述的完整过程http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/是
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
$ echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
$ sudo apt-get update
$ sudo apt-get install mongodb-10gen
$ sudo apt-get install mongodb-10gen=2.2.3
$ echo "mongodb-10gen hold" | sudo dpkg --set-selections
$ sudo service mongodb start
$ mongod --version
db version v2.4.6
Wed Oct 16 12:21:39.938 git version: b9925db5eac369d77a3a5f5d98a145eaaacd9673
IMPORTANT:Make sure you change 2.4.6 to the latest version (or whatever you want to install). Find the latest version number here http://www.mongodb.org/downloads
重要提示:确保将 2.4.6 更改为最新版本(或您想要安装的任何版本)。在这里找到最新的版本号http://www.mongodb.org/downloads
回答by alexclooze
To be complete, a short introduction for "shell noobs":
为了完整起见,对“shell noobs”做一个简短的介绍:
First of all, start your shell - you can find it inside the common desktop environments under the name "Terminal" or "Shell" somewhere in the desktops application menu.
首先,启动您的 shell - 您可以在桌面应用程序菜单中某个名为“终端”或“外壳”的常见桌面环境中找到它。
You can also try using the key combo CTRL+F2, followed by one of those commands (depending on the desktop envrionment you're using) and the ENTER key:
您还可以尝试使用组合键 CTRL+F2,然后是这些命令之一(取决于您使用的桌面环境)和 ENTER 键:
xfce4-terminal
gnome-console
terminal
rxvt
konsole
If all of the above fail, try using xterm
- it'll work in most cases.
如果以上所有方法都失败,请尝试使用xterm
- 它在大多数情况下都有效。
Hint for the following commands: Execute the commands without the $
- it's just a marker identifying that you're on the shell.
提示以下命令: 不带$
-执行命令- 它只是标识您在 shell 上的标记。
After that just fire up mongod
with the --version
flag:
在此之后刚刚火起来mongod
与--version
标志:
$ mongod --version
It shows you then something like
它向你展示了类似的东西
$ mongod --version
db version v2.4.6
Wed Oct 16 16:17:00.241 git version: nogitversion
To update it just execute
要更新它只需执行
$ sudo apt-get update
and then
进而
$ sudo apt-get install mongodb
回答by afghanbloodhound
inside shell:
壳内:
mongod --version
回答by Swadeshi
When you entered in mongo shell using "mongo" command , that time only you will notice
当您使用“mongo”命令进入 mongo shell 时,只有您会注意到
MongoDB shell version v3.4.0-rc2
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.0-rc2
also you can try command,in mongo shell ,
db.version()
您也可以在 mongo shell 中尝试命令,
db.version()
回答by Pransh Tiwari
In the terminal just enter the traditional command:
在终端中输入传统命令:
mongod --version