Installation
Windows Installation
Method 1: MongoDB Installer (Recommended)
Download the MongoDB Community Server from official website
Run the installer and follow the setup wizard
Choose "Complete" setup type
Check "Install MongoDB as a Service"
Set data directory to
C:\data\db(or create manually if needed)
Method 2: Using Chocolatey (Package Manager)
choco install mongodbConfigure Path Environment Variable
Add MongoDB's bin directory to your system PATH:
# Default installation path
$env:Path += ";C:\Program Files\MongoDB\Server\{version}\bin"Start MongoDB Service
# Start MongoDB service
net start MongoDB
# Stop MongoDB service
net stop MongoDBLinux Installation
Ubuntu/Debian
RHEL/CentOS/Fedora
macOS Installation
Method 1: Using Homebrew (Recommended)
Method 2: Manual Installation
Download MongoDB from official website
Extract the archive:
Move to appropriate location:
Add to PATH:
Verifying Installation
Check MongoDB Version
Test MongoDB Connection
Log Files Location
Linux:
/var/log/mongodb/mongod.logmacOS:
/usr/local/var/log/mongodb/mongo.logWindows:
C:\Program Files\MongoDB\Server\{version}\log\mongod.log
Uninstall MongoDB
Ubuntu/Debian
macOS (Homebrew)
Windows
Use Control Panel > Programs and Features
Or use Chocolatey:
choco uninstall mongodb
Last updated