First download the installation package to the MongoDB site http://www.mongodb.org/
Choose according to your operating system type and 32/64-bit.
Installing on Windows
Unzip the installation package and then create a directory for the data file, MongoDB the default C:\data\db as the data directory, or create other empty directories to save.
Set up the data directory, open the command prompt (Cmd.exe), into the MongoDB bin directory, execute Mongod.exe, if not the default directory to do the data directory, you need to use –dbpath to specify Mongod.exe–dbpath my directory
Sign up for MongoDB services
Use the full path to run, ignore all spaces, and use the –install option to install it.
Copy Code code as follows:
C:\mongodb\bin\mongod.exe–dbpath C:\data–install
install under Linux
In the same way, the data directory is created first, the default data directory is/data/db,
Create a directory and set write permissions as follows:
Copy Code code as follows:
$ mkdir-p/data/db
$ chown-r $USER: $USER/data/db
Into the MongoDB directory,
Copy Code code as follows:
You can also use –dbpath to specify a different data directory
Copy Code code as follows:
$ bin/mongod-dbpath/data/db
For additional options about MongoDB, use Mongod–help to view