MongoDB — Installation
Requirements
- Windows 10+, macOS 10.14+, Linux
- 4GB RAM minimum
- 10GB disk space
Windows
- Download MongoDB Community Server
- Run installer
- Choose complete installation
- Install as service
macOS
# Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Add MongoDB tap
brew tap mongodb/brew
# Install
brew install mongodb-community
# Start service
brew services start mongodb-community
Linux (Ubuntu)
# Import public key
wget -qO - https://www.mongodb.org/static/pgp/server-7.0.asc | sudo apt-key add -
# Add repository
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
# Install
sudo apt-get update
sudo apt-get install -y mongodb-org
# Start
sudo systemctl start mongod
Docker
docker run -d -p 27017:27017 --name mongodb mongo:latest
Verify
mongosh
db.runCommand({ ping: 1 })
Mini Practice
- Install MongoDB
- Start the service
- Connect with mongosh
- Verify installation
Up Next
Continue with Databases — creating databases.
Related Topics
Frequently Asked Questions about Installation
What is Installation in MongoDB?
Installation is a fundamental concept in MongoDB. This lesson explains it step by step with clear examples, making it easy for beginners to understand.
How do I learn Installation?
Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn Installation.
Why is Installation important in MongoDB?
Installation is essential for MongoDB development. Understanding this concept will help you write better code and solve real-world problems more effectively.