MongoDB is available for both Cloud and Self managed platform.
MongoDB Atlas is the fully managed and automated cloud based database service available for AWS, Azure, and Google Cloud.
For self manage, MongoDB offers two editions, Community and Enterprise.
We will start with various editions of mongodb and then how to install them.
The MongDB Installation might require knowledge of servers and development on some operating systems.
MongoDB comes with two editions, Community and Enterprise. Community is the open-source version with great feature, but Enterprise comes with advance features and support.
MongoDB Community Vs Enterprise
|Role based Access Controls||yes||yes|
Also install MongoDB Compass, a free GUI for MongoDB Compass.
Install MongoDB on MacOS
MongoDB is supported in MacOS 10.11 and above versions.
MongoDB 4.2 Community Editions supports only macOS 10.12 or later. We are installing MongoDB 4.2 in MacOS 10.14 (Mojave).
Install MongoDB using Homebrew.
Install Homebrew brew package manager for MacOS. By default MacOS doesn't include brew package. Here is step by step guide to install MongoDB using brew.
- brew tap mongodb/brew
- brew install firstname.lastname@example.org
Run MongoDB Community edition
Run MongoDb in background
Install MongoDB using .tgz Tarball
Here is the step by step guide to install MongoDB Community edition on MacOS using .tgz Tarball.
- Download MongoDB from official site, i.e. MongoDB 4.2 .tgz
- Extract files from archive. Double click on .tgz file. The extracted version would end with
- Copy binaries in /bin directory to usr/local/bin. Press Cmd + shift + g , and type /usr/local/bin/
- Create a directory to store MongoDB data.
mkdir -p /data/db
- Check permissions of directory.
sudo chown -R `id -un` /data/db
- Run MongoDB demon.
- In another terminal window, run Mongo shell.
- To exit mongo shell, type quit() and to stop MongoDB demon, press ctrl+c
Install MongoDB on windows
Here is a step by step guide to install MongoDb on windows. You need Windows 10 / 8.1 / 8 / 7 or Windows Server 2008 R2 / 2012 / 2012 R2 / 2016 / 2019.
- Download MongoDB MSI Installer.
- Run MongoDB MSi Installer.
- Follow installation steps.
- Choose MongoDB as windows services or just install binaries.
- Install MongoDB Compass.
- Create a directory data/db in C drive, or default drive of OS.
- Start MongoDB.
Install MongoDB on Linux
To install MongoDB on Linux, please check list of supported Linux Distributions.
Linux OS supporting MongoDB
- Red Hat
Install MongoDB on Ubuntu
Import public key using package management.
wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
gnupg is not installed, try thissudo apt-get install gnupgwget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
- Reload local package database
sudo apt-get update
- Install MongoDBpackage
sudo apt-get install -y mongodb-org
- Run MongoDB