Installing MongoDB Community Edition
Installation Guide
Installing MongoDB Community Edition involves different steps depending on your operating system. Below is a brief guide for installing MongoDB on Windows, macOS, and Ubuntu Linux.
1. Windows Installation
Prerequisites:
Windows Server 2022, Windows Server 2019, or Windows 11 (64-bit).
Steps:
Download the Installer:
Visit the MongoDB Download Center and select the latest version for Windows.
Choose the MSI package and click "Download."
Run the Installer:
Locate the downloaded
.msifile and double-click to run it.
Follow the Installation Wizard:
Choose "Complete" for a full installation.
Opt to install MongoDB as a Windows service for automatic startup.
Specify data and log directories if different from defaults.
Install MongoDB Shell (
mongosh):The installer does not include
mongosh. Download and install it separately from the MongoDB Shell Installation Instructions.
Start MongoDB:
If installed as a service, it starts automatically.
To start manually, open Command Prompt as Administrator and run:
arduino복사편집"C:\Program Files\MongoDB\Server\8.0\bin\mongod.exe" --dbpath="C:\data\db"
For detailed instructions, refer to the official MongoDB documentation for Windows.
2. macOS Installation
Prerequisites:
macOS 11 or later.
Homebrew package manager installed.
Steps:
Install Xcode Command-Line Tools:
Open Terminal and run:
Install Homebrew (if not already installed):
Follow the instructions on the Homebrew website.
Tap the MongoDB Homebrew Tap:
In Terminal, run:
Update Homebrew:
Run:
Install MongoDB:
Run:
Start MongoDB:
To run MongoDB as a macOS service:
To stop the service:
For detailed instructions, refer to the official MongoDB documentation for macOS.
3. Ubuntu Linux Installation
Prerequisites:
Ubuntu 20.04 LTS or later.
Steps:
Import the Public Key:
Open Terminal and run:
Create the List File:
For Ubuntu 20.04 (Focal), run:
Reload the Package Database:
Run:
Install MongoDB:
Run:
Start MongoDB:
Run:
To enable MongoDB to start on system reboot:
For detailed instructions, refer to the official MongoDB documentation for Ubuntu.
Post-Installation:
Verify Installation:
Open the MongoDB shell by running
mongoshin your terminal or command prompt.To check the MongoDB server version, run:
Configure as Needed:
Modify the MongoDB configuration file (
mongod.conf) to suit your requirements.
For comprehensive installation instructions and additional details, please refer to the official MongoDB installation documentation.
Last updated