0 Tk

Installation Guide

Installation Guide

Installing MongoDB involves several steps, which vary depending on your operating system. This guide covers installation for Windows, macOS, and Linux (Ubuntu).

Windows Installation

  1. Download the MongoDB Community Server from the official website.
  2. Run the installer and follow the installation wizard.
  3. Optionally, install MongoDB Compass for a GUI.
  4. Add MongoDB’s bin folder to your system PATH.
# Add MongoDB bin folder to PATH (PowerShell) $env:Path += ";C:\Program Files\MongoDB\Server\4.4\bin"

macOS Installation

Using Homebrew:

# Tap the MongoDB Homebrew Tap
brew tap mongodb/brew

# Install MongoDB
brew install mongodb-community

# Start MongoDB as a service
brew services start mongodb-community

Linux (Ubuntu) Installation

# Import the public key
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -

# Create a list file for MongoDB
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list

# Reload local package database
sudo apt-get update

# Install MongoDB packages
sudo apt-get install -y mongodb-org

# Start MongoDB
sudo systemctl start mongod

Verifying Your Installation

After installation, verify your installation by running MongoDB:

mongo

This command should start the MongoDB shell, indicating a successful installation.

Next Steps

Now that you have MongoDB installed, you’re ready to learn about the basic concepts and start using the database. Proceed to the next section to understand the fundamental concepts of MongoDB.