How to Install and configure MongoDB securely on Ubuntu 12.04

mongodb-logoTo install mongodb on Ubuntu we can use a shell script which will help you to reduce key stokes.

Create a script file named “”

Add the below lines to the file.

Set appropriate permisssion to the file.

Then run the sctipt

If there no errot then you will get the below result

To validate use below command

Now login to the mongo console by issueing below command:

After login to the console now we will create an admin user:

Now shut down the server and exit

Restart Mongod with –auth

Run mongo again in 2 ways:
Run mongo first then login.

Run & login to mongo in command line.

* The username & password will work the same for mongodump and mongoexport.

The following two tabs change content below.

Tapas Mishra

Sr. Engineer (DevOps)
Loves to work on Opensource products. Having experience on Linux environment. Knowledge on Public cloud services like AWS, Rackspace, DigitalOcean, Linode. Please don't hesitate to give a comment on the posts. Your comments are my strength.

Leave a Reply