T. Ato T. Ato - 1 year ago 200
Linux Question

Where is mongo shell installed on Amazon Linux?

I successfully installed MongoDB on an Amazon Linux AMI by following this tutorial: https://docs.mongodb.com/v3.0/tutorial/install-mongodb-on-amazon/

The log (

) shows that mongo is up-and-running, so I know it was correctly installed.

However, I can't figure out how to access the mongo shell. I know the shell package was installed because:

$ sudo yum install mongodb-org-shell
Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main/latest | 2.1 kB 00:00
amzn-updates/latest | 2.3 kB 00:00
Package mongodb-org-shell-3.0.12-1.amzn1.x86_64 already installed and latest version
Nothing to do

Where can I find/how do I run the Mongo shell on my EC2 instance?

Answer Source

Go to your "mongodb installation dir" (Common Path is /etc/mongo):

cd <mongodb installation dir>

Type ./bin/mongo to start mongo:


If you have added the /bin to the PATH environment variable, you can just type mongo instead of ./bin/mongo.

To display the database you are using, type db:


The operation should return test, which is the default database. To switch databases, issue the use helper, as in the following example:

use <database>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download