This page
explains the installation procedure of MongoDB for MS-Windows environment.
MongoDB Installation
This will setup MongoDB as a service on windows, so that the database will start automatically following each reboot cycle.
MongoDB Installation
This will setup MongoDB as a service on windows, so that the database will start automatically following each reboot cycle.
- Go
to http://www.mongodb.org/downloads and choose
the appropriate package (Windows 32-bit versus 64-bit; choose *2008+ if
you are on Windows-7 64-bit)
- Extract
the zip-file, and rename the folder to "mongodb"
- Move
the resulting folder to C:\work resulting in C:\work\mongodb (all files
should be in the bin-directory inside mongodb-dir)
- Create
a directory for storing the generated logs at
C:\work\mongodb\log
- MongoDB
needs a data directory for storage; create a directory C:\work\data\db
- Create
a config-file at C:\work\mongodb\mongod.cfg directory with the
following content
logpath=C:\work\mongodb\log\mongo.log
dbpath=C:\work\data - Start
the Command Prompt by selecting the Start Menu,
then All Programs, then Accessories, then right
click Command Prompt, and select Run as
Administrator from the popup menu.
- In
the command-prompt with admin-privileges, type the following commands:
C:\work\mongodb\bin\mongod.exe --config C:\work\mongodb\mongod.cfg --install
net start MongoDB
- Exit
the cmd-prompt shell. This should install MongoDB as service which
will start automatically following each reboot cycle
- Open
an ordinary cmd-prompt shell by typing "cmd.exe" in Windows
start, and type "C:\work\mongodb\bin\mongo.exe" ; you should see
a MongoDB-Shell which is connected to the "test" database.
- Type
"db.test.save( { a: 1 } )" to add a record to the data-base
- Now
check if the record was added by typing "db.test.find()"
0 comments:
Post a Comment