Friday, January 25, 2013

MongoDB Installation: Standalone Mode

"Mongo" is a short for "Humongous" meaning "Huge".
By the name it goes that, MongoDB is a database phenomenal at dealing with "huge" piles of data.

As per the MongoDB Documentation,
"MongoDB is a scalable, high-performance, open source NoSQL database."

Installing MongoDB in standalone is guileless. It is also achievable using apt-get command in case of Linux. This post is for you if you wish to know what configuration files are used in MongoDB and if you intend to go a longer way rather than just a standalone installation and a casual try out of MongoDB.

Tested On
I have tested the following steps on Ubuntu 10.04 and MongoDB 2.2.2. 

Steps of Installation Step 1: Every version of MongoDB setups comes in two flavors:
  • 32-bit
  • 64-bit
The 32-bit builds run on both 32 and 64-bit machines while 64-bit build runs only on the 64-bit machines. However, as per the MongoDB manual,
"32-bit builds are limited to around 2GB of data. In general you should use the 64 bit builds. The 32 bit binaries are ok for replica set arbiters and mongos but not for production mongod's."

So it would be good to figure out the machine configuration before deployment.
Run the following command to know your machine
uname -m                                                                                         

it would return "i686" for 32 bit machines and "x86_64" for 64 bit machines.

Step 2: According to the Step 1 results download the setup from
Untar the downloaded setup using 

tar  -zxvf  location_of_setup                                                             

Step 3: MongoDB requires 2 directories for it's functioning. They are:
1. Directory for storing the logs
2. Another directory for storing the data i.e. dbpath (by default /data/db)
You can use any suitable location on your machine to create these directories. For example, here we'll be taking
Log Directory: /var/log/mongodb
DBPath: /var/lib/mongodb

Create the above 2 directories as below:
mkdir /var/lib/mongodb
mkdir /var/log/mongodb           

Change their permissions as below:
sudo chmod -R 777 /var/lib/mongodb
sudo chmod -R 777 /var/log/mongodb

Change their ownership to the user (root or non-root) as below:
sudo chown groupName:userName /var/lib/mongodb -R
sudo chown groupName:userName /var/log/mongodb -R

Also change the ownership of the directory where mongodb's setup is copied using similar commands as above.

Step 4: Create a conf file (for example "mongod.conf") at a location owned and accessible by the user.

Step 5: Start the MongoD daemon using:
/bin/mongod --config /path_to_conf_file/mongod.conf                  
Step 6: Verify whether the MongoD daemon is running or not using:
sudo netstat -nlp | grep mongod                                                    

 Step 7: Start using mongodb by opening the mongo shell using:

This completes the installation process of MongoDB in standalone mode. In my next post, I'll be catering steps on how to setup a MongoDB Replica Set.


  1. Hello there,

    Thanks for the blog.
    What to tune in MongoDB SERVER after installation ?

  2. Excellent and easy steps.....

  3. Anyone help me plz thanks in advance

  4. Your new valuable key points imply much a person like me and extremely more to my office workers. With thanks; from every one of us.

    Best AWS Training in Chennai | Amazon Web Services Training in Chennai

  5. Inspiring writings and I greatly admired what you have to say , I hope you continue to provide new ideas for us all and greetings success always for you..Keep update more information..

    angularjs Training in chennai
    angularjs Training in chennai

    angularjs-Training in tambaram

    angularjs-Training in sholinganallur

    angularjs-Training in velachery

  6. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.
    python training in velachery | python training institute in chennai

  7. Great post! I am actually getting ready to across this information, It’s very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.
    Devops Training courses
    Devops Training in Bangalore
    Best Devops Training in pune
    Devops interview questions and answers

  8. I appreciate that you produced this wonderful article to help us get more knowledge about this topic. I know, it is not an easy task to write such a big article in one day, I've tried that and I've failed. But, here you are, trying the big task and finishing it off and getting good comments and ratings. That is one hell of a job done!

    Java training in Chennai | Java training in USA | Java training in Kalyan nagar

    Java training in Indira nagar | Java training in Rajaji nagar

  9. I was recommended this web site by means of my cousin. I am now not certain whether this post is written through him as nobody else recognise such precise about my difficulty. You're amazing! Thank you!

    Data Science Training in Chennai | Data Science training in anna nagar

    Data Science training in chennai | Data science training in Bangalore

    Data Science training in marathahalli | Data Science training in btm layout

  10. Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.

    rpa interview questions and answers
    automation anywhere interview questions and answers
    blueprism interview questions and answers
    uipath interview questions and answers
    rpa training in chennai