Monday, April 04, 2016

Install Mongodb and run as a service to start automatically for windows

This blog post will explain where to download mongodb, how to install and how to configure to start service automatically.  

Step 1: Download mongodb, I am using community edition.  Follow step by step installation process to install mongodb.

After installation a directory inside C:\Program Files is created.  
Example:  In my case:  C:\Program Files\MongoDB\Server\[version]

Please note: [version] can be current version you have downloaded.  Example: 2.4

Step 2:  Move the Mongodb directory to c:\ for easy access. i.e. C:\MongoDB\Server\[version]

Step 3:  Create directories inside C:\MongoDB\Server\[version]
mkdir C:\MongoDB\Server\[version]\data
mkdir C:\MongoDB\Server\[version]\logfiles

Step 4: Create mongod.conf file in C:\MongoDB\Server\[version], Add following content in it and save the file.
# Where data files will reside

# Where the log file will be stored

# how verbose the server will be logging

Step 5:
Open command line as administrator.
Type following commands to start mongodb as service, so that you don't have to manually start mongo server each time.

C:\MongoDB\Server\[version]\bin> mongod -f C:\MongoDB\Server\[version]\mongod.conf --install

C:\MongoDB\Server\[version]\bin>net start MongoDB

And you are good to go.  Your mongodb is up and running.


For creating database, collection and document for mongodb you can download robomongo which is nice GUI for mongodb.

That's it.  It is that easy.


In case you are interested in installing mongodb on ubuntu then following link will be helpful.

Most Recent Post

Subscribe Blog via Email

Enter your email address:

Disclaimers:We have tried hard to provide accurate information, as a user, you agree that you bear sole responsibility for your own decisions to use any programs, documents, source code, tips, articles or any other information provided on this Blog.
Page copy protected against web site content infringement by Copyscape