Reputation: 1329
I just installed MongoDB version 3.2.4 on Ubuntu 15.10 and I want to run the mongo shell.
All docs are suggesting to execute first the command cd <mongodb installation dir>
My question is where is that mongodb installation dir
?
How I can find it?
Apparently it may be something wrong with the mongod
.
Could not find /usr/bin/mongod
Details below.
root@levilinode:/usr/bin# service mongod status
● mongod.service - LSB: An object/document-oriented database
Loaded: loaded (/etc/init.d/mongod)
Active: active (exited) since Tue 2016-04-12 14:22:45 EDT; 1h 37min ago
Docs: man:systemd-sysv-generator(8)
Apr 12 14:22:45 levilinode systemd[1]: Starting LSB: An object/document-oriented database...
Apr 12 14:22:45 levilinode mongod[16541]: Could not find /usr/bin/mongod
Apr 12 14:22:45 levilinode systemd[1]: Started LSB: An object/document-oriented database.
Apr 12 14:24:02 levilinode systemd[1]: Started LSB: An object/document-oriented database.
Apr 12 14:24:26 levilinode systemd[1]: Started LSB: An object/document-oriented database.
Apr 12 15:56:15 levilinode systemd[1]: Started LSB: An object/document-oriented database.
However that files seems to be there:
root@levilinode:/usr/bin# ls -la mong*
-rwxr-xr-x 1 root root 19816422 Mar 7 18:32 mongo
-rwxr-xr-x 1 root root 35865168 Mar 7 18:32 mongod
-rwxr-xr-x 1 root root 14661359 Mar 7 18:32 mongodump
-rwxr-xr-x 1 root root 10523458 Mar 7 18:32 mongoexport
-rwxr-xr-x 1 root root 10395740 Mar 7 18:32 mongofiles
-rwxr-xr-x 1 root root 10636848 Mar 7 18:32 mongoimport
-rwxr-xr-x 1 root root 10125973 Mar 7 18:32 mongooplog
-rwxr-xr-x 1 root root 35551461 Mar 7 18:32 mongoperf
-rwxr-xr-x 1 root root 17331345 Mar 7 18:32 mongorestore
-rwxr-xr-x 1 root root 16086077 Mar 7 18:32 mongos
-rwxr-xr-x 1 root root 10353518 Mar 7 18:32 mongostat
-rwxr-xr-x 1 root root 10213613 Mar 7 18:32 mongotop
Upvotes: 8
Views: 31319
Reputation: 1329
I think I solved the connectivity problem based on this question:
Then I run as indicated in the link shown above the commands:
sudo rm /var/lib/mongodb/mongod.lock
sudo service mongod restart
An now all seems to be working ok.
Upvotes: 3
Reputation: 8437
Multiple options:
$ sudo updatedb; locate mongo
Both mongo and mongod commands are in the same dir, so if this dir has been added in your $PATH by the installer, this should tell you where they are.
$ which mongo
$ which mongod
/var/lib
or /usr/local
or /usr/bin
(must be a symlink though)$ ps -efa | grep mongo
Upvotes: 6
Reputation: 1352
It would be in where you decompressed the tar.gz file that you downloaded from the MongoDB website. Inside, there is a mongod executable that you need to run before you can open the shell and operate the database.
Alternatively, you can create symlinks for the executables that you want to use:
sudo ln -s /dir/to/your/mongodb/folder/mongo /usr/local/bin/mongo
sudo ln -s /dir/to/your/mongodb/folder/mongod /usr/local/bin/mongod
And you can simply type in these two commands anywhere in terminal.
Upvotes: 1