- Install MongoDB
- Install Mongodb Macos Catalina
- Mongodb Macos Installer
- Mongodb Install Macbook
- Mongodb Compass Mac Install
- Mongodb Install Macos Catalina
Author: MongoDB Documentation Team
This guide describes how to install MongoDB locally. If you wouldlike to use MongoDB in the Cloud using Atlas
, our manageddatabase product, see Get Started with Atlas.
Time required: 10 minutes
Robo 3T (formerly Robomongo) is the free, lightweight, open-source MongoDB GUI with an embedded mongo shell, real auto-completion, and support for MongoDB 4.0. MongoDB exporter. This is the new MongoDB exporter implementation that handles ALL metrics exposed by MongoDB monitoring commands. This new implementation loops over all the fields exposed in diagnostic commands and tries to get data from them. 此外你还可以使用 OSX 的 brew 来安装 mongodb: brew tap mongodb/brew brew install mongodb-community@4.4 @ 符号后面的 4.4 是最新版本号。.
What You’ll Need¶
MongoDB supports a variety of 64-bit platforms. Refer to theSupported Platforms table toverify that MongoDB is supported on the platform to which you wishto install it.
Procedure¶
Install MongoDB¶
- Windows
- macOS
- Linux
Download the binaries from the MongoDB Download Center.
This post will teach you how to store images into a MongoDB database using the Mongoose ODM as well as retrieve and display those images. Once we have established a connection to our database.
Open Windows Explorer/File Explorer.
Change the directory path to where you downloaded the MongoDB
.msi
file. By default, this is%HOMEPATH%Downloads
.Double-click the
.msi
file.The Windows Installer guides you through the installation process.
If you choose the Custom installation option, you mayspecify an installation directory.
MongoDB does not have any other system dependencies. You can install and run MongoDB from any folder you choose.
Note
This tutorial assumes that you installed MongoDBin
C:ProgramFilesMongoDBServer4.2
.
Platform Support
MongoDB only supports macOS versions 10.11 and later on Intel x86-64.
Download the binary files for the desired release of MongoDB.¶
Download the binaries from the MongoDB Download Center.
Extract the files from the downloaded archive.¶
For example, from a system shell, you can extract through the tar
command:
Copy the extracted archive to the target directory.¶
Copy the extracted folder to the location from which MongoDB will run.
Ensure the location of the binaries is in the PATH
variable.¶
The MongoDB binaries are in the bin/
directory of the archive. Toensure that the binaries are in your PATH
, you can modify yourPATH
.
For example, you can add the following line to your shell’src
file (e.g. ~/.bashrc
):
Install Mongodb Macos Catalina
Replace <mongodb-install-directory>
with the path to the extractedMongoDB archive.
Note
These instructions are for installing MongoDB directly froman archive file. If you would rather use your linuxdistribution’s package manager, refer to theinstallation instructions for yourdistribution in the MongoDB Manual.
Download the binary files for the desired release of MongoDB.¶
Download the binaries from the MongoDB Download Center.
Extract the files from the downloaded archive.¶
Extract the archive by double-clicking on the tar file or usingthe tar
command from the command line, as in the following:
Copy the extracted archive to the target directory.¶
Copy the extracted folder to the location from which MongoDB will run.
Ensure the location of the binaries is in the PATH
variable.¶
The MongoDB binaries are in the bin/
directory of the archive. Toensure that the binaries are in your PATH
, you can modify yourPATH
.
For example, you can add the following line to your shell’src
file (e.g. ~/.bashrc
):
Replace <mongodb-install-directory>
with the path to the extractedMongoDB archive.
Run MongoDB¶
- Windows
- macOS
- Linux
Warning
Do not make mongod.exe
visible on publicnetworks without running in “Secure Mode” with theauth
setting. MongoDB is designed to be run intrusted environments, and the database does not enable“Secure Mode” by default.
Set up the MongoDB environment.¶
Mongodb Macos Installer
MongoDB requires a data directory to store alldata. MongoDB’s default data directory path is the absolute pathdatadb
on the drive from which you start MongoDB. Createthis folder by running the following command in aCommand Prompt:
You can specify an alternate path for data files using the--dbpath
option tomongod.exe
, for example:
If your path includes spaces, enclose the entire path in doublequotes, for example:
You may also specify the dbpath
in a configuration file.
Start MongoDB.¶
To start MongoDB, run mongod.exe
. For example, from theCommand Prompt:
This starts the main MongoDB database process. The waitingforconnections
message in the console output indicates that themongod.exe
process is running successfully.
Depending on the security level of your system, Windows may pop up aSecurity Alert dialog box about blocking “some features” ofC:ProgramFilesMongoDBServer4.0binmongod.exe
from communicatingon networks. All users should select PrivateNetworks,suchasmyhomeorworknetwork
and click Allowaccess
. For additional information onsecurity and MongoDB, please see the Security Documentation.
Verify that MongoDB has started successfully¶
Verify that MongoDB has started successfully bychecking the process output for the following line:
The output should be visible in the terminal or shell window.
You may see non-critical warnings in the processoutput. As long as you see the log line shown above, you can safelyignore these warnings during your initial evaluation of MongoDB.
Connect to MongoDB.¶
To connect to MongoDB through the ~bin.mongo.exe
shell,open another Command Prompt.
Create the data directory¶
Before you start MongoDB for the first time, create the directory towhich the mongod
process will write data. By default, themongod
process uses the /data/db
directory. If you createa directory other than this one, you must specify that directory in thedbpath
option when starting the mongod
processlater in this procedure.
The following example command creates the default /data/db
directory:
Set permissions for the data directory¶
Before running mongod
for the first time, ensure that theuser account running mongod
has read and write permissionsfor the directory.
Run MongoDB¶
To run MongoDB, run the mongod
process at the system prompt.If necessary, specify the path of the mongod
or the datadirectory. See the following examples.
Run without specifying paths¶
If your system PATH
variable includes the location of themongod
binary and if you use the default data directory(i.e., /data/db
), simply enter mongod
at the system prompt:
Specify the path of the mongod
¶
If your PATH
does not include the location of themongod
binary, enter the full path to the mongod
binary at the system prompt:
Specify the path of the data directory¶
If you do not use the default data directory (i.e., /data/db
),specify the path to the data directory using the--dbpath
option:
Verify that MongoDB has started successfully¶
Verify that MongoDB has started successfully bychecking the process output for the following line:
The output should be visible in the terminal or shell window.
You may see non-critical warnings in the processoutput. As long as you see the log line shown above, you can safelyignore these warnings during your initial evaluation of MongoDB.
Important
If you are using SELinux on a Red Hat Linux-based system,(Red Hat Enterprise Linux or CentOS Linux), you mustconfigure SELinux to allow MongoDB to start. Refer toConfigure SELinux for instructions.
Mongodb Install Macbook
Create the data directory¶
Before you start MongoDB for the first time, create the directory towhich the mongod
process will write data. By default, themongod
process uses the /data/db
directory. If you createa directory other than this one, you must specify that directory in thedbpath
option when starting the mongod
processlater in this procedure.
The following example command creates the default /data/db
directory:
Set permissions for the data directory¶
Before running mongod
for the first time, ensure that theuser account running mongod
has read and write permissionsfor the directory.
Run MongoDB¶
To run MongoDB, run the mongod
process at the system prompt.If necessary, specify the path of the mongod
or the datadirectory. See the following examples.
Run without specifying paths¶
If your system PATH
variable includes the location of themongod
binary and if you use the default data directory(i.e., /data/db
), simply enter mongod
at the system prompt:
Specify the path of the mongod
¶
If your PATH
does not include the location of themongod
binary, enter the full path to the mongod
binary at the system prompt:
Specify the path of the data directory¶
If you do not use the default data directory (i.e., /data/db
),specify the path to the data directory using the--dbpath
option:
Verify that MongoDB has started successfully¶
Mongodb Compass Mac Install
Verify that MongoDB has started successfully bychecking the process output for the following line:
The output should be visible in the terminal or shell window.
You may see non-critical warnings in the processoutput. As long as you see the log line shown above, you can safelyignore these warnings during your initial evaluation of MongoDB.
Mongodb Install Macos Catalina
Summary¶
If you have successfully completed this guide, you have installedMongoDB and are ready to connect to your mongod
instance and start inserting data.
What’s Next¶
The next guide walks you through setting up authentication on your new MongoDB instance.
See Also¶
- ALLISON ADDED THIS '>/installation> ALLISON ADDED THAT
- Structure your Data for MongoDB for an introduction to MongoDB.
- Installation for installation instructionsfor MongoDB Enterprise Edition, details on installing olderversions of MongoDB.
© MongoDB, Inc 2008-present. MongoDB, Mongo, and the leaf logo are registered trademarks of MongoDB, Inc.