Installation steps for MongoDB on Windows 7

Installation steps for MongoDB on Windows 7

Posted by Andy on 2015-03-28 07:11:14.0


Hi Andy,

Following are the steps to install MondoDB on Windows 7 machine.

 

1. Download MongoDB from it's official MongoDB website. Choose Windows 32 bits or 64 bits. Unzip, extracts to your prefer location, for example : d:\mongodb\.

2. Create a MongoDB config file, it’s just a text file, for example : d:\mongodb\mongo.config

3. Add MongoDB as Windows Service, so that MongoDB will start automatically following each system restart.

4. d:\mongodb\bin> mongod --config D:\mongodb\mongo.config --install

5. net start MongoDB

6. If you want you can add path to mongo.exe to classpath.

7. mongostat will give complete status report of MongoDB.

Enjoy!!! Happy Programming

 

Posted by Puneet on 2015-05-09 08:12:10.0


Hi Andy ,

Below are the steps in detail in order to install MongoDB on Windows 7

Solution : Installation steps for MongoDB on Windows 7

Step 1 : Go to http://www.mongodb.org/downloads click on the DOWNLOAD (MSI) button as shown
 
Step 2 : Run the .msi file and follow the installation process. During the set up, choose Custom ⇒ Browse as per the screenshot to specify a location of your choice for installing MongoDB .
 
Step 3 : Enter the Home directory of MongoDB and click on Ok ⇒ Next ⇒ Install

Step 4 : After the installation process, you should see the following directory structure inside mongodb folder .

Step 5 : Inside the mongodb folder, Create a new folder named data and create another folder inside Data and name it to db. This is the folder where your databases will be stored.
 
i.e. E:\mongodb\data\db

Following is the command to create data and db folder through command prompt
 
$ cd E:\mongodb
$ mkdir data data\db
 
Step 6 : Create mongod.conf file with following information in the home directory of MongoDB i.e. E:\mongodb\mongod.conf

Now, Installation has been completed, Following steps are use to start the MongoDb Server and Connect it through MongoDB Client.

Step 1 : Open the cmd.exe

Step 2 : Run MongoDB server, with mongod.exe

 
$ cd E:\mongodb\bin
$ mongod.exe --dbpath "E:\mongodb\data\db"


E:\mongodb\bin>mongod.exe --dbpath E:\mongodb\data\db
2015-05-08T12:49:10.371+0530 I CONTROL  Hotfix KB2731284 or later update is not installed, will zero-out data files
2015-05-08T12:49:10.381+0530 I JOURNAL  [initandlisten] journal dir=E:\mongodb\data\db\journal
2015-05-08T12:49:10.391+0530 I JOURNAL  [initandlisten] recover : no journal files present, no recovery needed
2015-05-08T12:49:10.511+0530 I JOURNAL  [durability] Durability thread started
2015-05-08T12:49:10.513+0530 I JOURNAL  [journal writer] Journal writer thread started
2015-05-08T12:49:10.520+0530 I CONTROL  [initandlisten] MongoDB starting : pid=10844 port=27017 dbpath=D:\MongoDB\Server\data 64-bit host=MOBILE-JATIN
2015-05-08T12:49:10.521+0530 I CONTROL  [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2015-05-08T12:49:10.523+0530 I CONTROL  [initandlisten] db version v3.0.2
2015-05-08T12:49:10.524+0530 I CONTROL  [initandlisten] git version: 6201872043ecbbc0a4cc169b5482dcf385fc464f
2015-05-08T12:49:10.526+0530 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.1m-fips 19 Mar 2015
2015-05-08T12:49:10.528+0530 I CONTROL  [initandlisten] build info: windows sys.getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Service Pack 1') BOOST_LIB_VERSION=1_49
2015-05-08T12:49:10.529+0530 I CONTROL  [initandlisten] allocator: system
2015-05-08T12:49:10.531+0530 I CONTROL  [initandlisten] options: { storage: { dbPath: "E:\mongoDB\Server\data" } }
2015-05-08T12:49:10.536+0530 I INDEX    [initandlisten] allocating new ns file D:\MongoDB\Server\data\local.ns, filling with zeroes...
2015-05-08T12:49:10.751+0530 I STORAGE  [FileAllocator] allocating new datafile D:\MongoDB\Server\data\local.0, filling with zeroes...
2015-05-08T12:49:10.753+0530 I STORAGE  [FileAllocator] creating directory D:\MongoDB\Server\data\_tmp
2015-05-08T12:49:10.901+0530 I STORAGE  [FileAllocator] done allocating datafile D:\MongoDB\Server\data\local.0, size: 64MB,  took 0.139 secs
2015-05-08T12:49:10.911+0530 I NETWORK  [initandlisten] waiting for connections on port 27017
2015-05-08T12:57:29.865+0530 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:60131 #1 (1 connection now open)
2015-05-15T15:49:15.610+0530 I NETWORK  [conn1] end connection 127.0.0.1:60131 (0 connections now open)
 
Step 3 : Open one more cmd.exe and run mongo.exe, its the client application to connect o MondoDB server. You will get something like following result on your command prompt.

E:\mongodb\bin>mongo.exe
2015-05-08T12:57:29.822+0530 I CONTROL  Hotfix KB2731284 or later update is not installed, will zero-out data files
MongoDB shell version: 3.0.2
connecting to: test
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
        http://docs.mongodb.org/
Questions? Try the support group
        http://groups.google.com/group/mongodb-user
>

MongoDB is now installed on your system !!  You can explorer other question to if you have issue while installing and running MondoDB on your machine

Cheers !!

Posted by Pathania on 2015-05-11 07:13:23.0