Updated: 5th Oct 2014 with MongoDb version 2.6.4
This was surprisingly easy and worked straight off. This is a compressed version of the actual mongodb setup guide which is referenced below.
Mongo Version : 3.0
Windows Version : Windows 8 64bit / Windows 7 64bit
Step1 : down load the Mongo Windows Version
Windows 64bit version from http://www.mongodb.org/downloadsI got a msi version and installed it in c:\mongodb\
Step2: Create Directories
I used an explorer window, but you could use command prompt.
mkdir c:\mongodb
mkdir c:\mongodb\bin
mkdir c:\mongodb\log
mkdir c:\mongodb\data
mkdir c:\mongodb\data\db
Step3: Copy Contents of ZIP to c:\mongodb (skip if you use msi installer)
I just dragged and dropped the file, will over right the bin directory.Step 4: Create a Config file
C:\mongodb\mongod.cfg
contents
logpath=C:\mongodb\log\mongo.log
logappend=true
dbpath = C:\mongodb\data\db
Step 5: Create a Windows Service
as per help page mongo
Step 6: Start the Service
THAT'S IT !!!!!
Quick Cheats Script
If you a tad (little) lazy like me you can just use the script below. Run a command prompt as Administrator and place the script below into a batch file like: goMondo.bat. The script will create the directories, config file, install and start the service.
echo off
echo Here we Go, Creating MongoDB on Windows
echo Created by Frank Kerrigan see http://rundevrun.blogspot.co.uk
echo Creating Base Directories
echo ==========================
mkdir c:\mongodb\log
mkdir c:\mongodb\data
mkdir c:\mongodb\data\db
echo Creating Mongdo Config File
echo ===========================
echo logpath=c:\mongodb\log\mongo.log > c:\mongodb\mongod.cfg
echo logappend=true >> c:\mongodb\mongod.cfg
echo dbpath=c:\mongodb\data\db >> c:\mongodb\mongod.cfg
echo Creating Windows Service
echo ========================
c:\mongodb\bin\mongod.exe --config c:\mongodb\mongod.cfg --install
echo Starting Mongo Service
echo ======================
net start MongoDB
Uninstall The Service
If you want to uninstall the MongoDB service, then stop it first. Open command prompt under Administrator.
c:\> sc delete MongoDB
c:\> sc delete MongoDB
Reference Doc
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/C# Driver Quick Start
http://www.mongodb.org/display/DOCS/CSharp+Driver+QuickstartSee Post 2 in The Series
C# Simple Dal Layer With MongoDBhttp://rundevrun.blogspot.co.uk/2014/10/c-simple-dal-layer-with-mongodb.html
I get an error saying "The service name is invalid." when trying to start the service.
ReplyDeleteNevermind, just had to run cmd as admin after chceking the logs.
ReplyDeleteThank you for this post.
ReplyDeleteExcellent! worked like a charm!
ReplyDeleteThanks, this was awesome
ReplyDeleteHi,
ReplyDeleteI am new to MongoDB. However, I could install successfully...
Thanks....