Guide to installing MongoDB by command (Windows Linux)

  • 2020-05-12 06:25:07
  • OfStack

First of all to download the installation package mongoDB site http: / / www mongodb. org /
Choose based on your operating system type and 32/64 bits.

Install on windows

Unzip the installation package and set up a directory for storing data files. MongoDB USES C:\data\db as the default data directory. You can also create other empty directories to store data files.

After setting up the data directory, open the command prompt (cmd.exe), go to mongoDB's bin directory, and execute mongod.exe

Sign up for mongodb's services

Use the full path to run, ignore all Spaces, and use the wokinstall option to install.


c:\mongodb\bin\mongod.exe � dbpath c:\data � install

linux install

Again, to create the data directory, the default data directory is /data/db,

To create a directory and set write permissions, do the following:


$ mkdir -p /data/db
$ chown -R $USER:$USER /data/db

Go to the mongodb directory,

$ bin/mongod

You can also use the wok 52en to specify other data directories

$ bin/mongod -dbpath /data/db

For other options for mongodb, use mongod and help


Related articles: