What version of MongoDB is installed on Ubuntu
Solution 1
ANSWER: Read the instructions #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
$ 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
Solution 2
inside shell:
$ mongod --version
Solution 3
To be complete, a short introduction for "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.
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:
xfce4-terminal
gnome-console
terminal
rxvt
konsole
If all of the above fail, try using xterm
- it'll work in most cases.
Hint for the following commands: Execute the commands without the $
- it's just a marker identifying that you're on the shell.
After that just fire up mongod
with the --version
flag:
$ 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
Solution 4
When you entered in mongo shell using "mongo" command , that time only you will notice
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()
Solution 5
In the terminal just enter the traditional command:
mongod --version
RachelD
I’m a software engineer and I pride myself on my ability to learn new technologies fast. I have experience with more than a dozen languages, database and version control systems. Additionally I have developed and launched numerous content management platforms. My goal is to expand my programming knowledge and become a recognized expert in my field. Want to know more? LinkedIn > Rachel L Dotey
Updated on July 14, 2022Comments
-
RachelD almost 2 years
Hi I'm a bit of a shell n00b.
Can anyone tell me how I would check the version of MongoDB that is installed on my Linux Ubuntu machine?
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.
Please and thank you.
Ok if I use db.version() inside of mongo shell it says 1.2.2
If I $ mongod --version I get this:
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?
-
Sammaye over 10 yearsBeing a console noob you must presume she does not know where ubuntu has installed mongod to
-
akluth over 10 yearsTo be complete I've added a short introduction on how to spawn a shell for those "real" noobs :-P
-
Jamie Hutber over 7 yearsBut how do you get to the shell :/
-
Niks over 7 years@JamieHutber It's just the usual Ubuntu shell prompt on your linux machine. akluth's answer below may help you on how to start the shell prompt stackoverflow.com/a/19405892/154325 On Ubuntu, I like the handy shortcut CTRL + ALT + T
-
shivadarshan almost 7 yearssorry!!! downvoted by mistake and unable to revert it!!! please edit ur answer to upvote.
-
Swadeshi almost 7 yearstry now. And avoid such mistakes in future @shivadarshan