Installation

Windows Installation

  • 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 mongodb

Configure 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 MongoDB

Linux Installation

Ubuntu/Debian

RHEL/CentOS/Fedora

macOS Installation

Method 2: Manual Installation

  1. Download MongoDB from official website

  2. Extract the archive:

  1. Move to appropriate location:

  1. Add to PATH:

Verifying Installation

Check MongoDB Version

Test MongoDB Connection

Log Files Location

  • Linux: /var/log/mongodb/mongod.log

  • macOS: /usr/local/var/log/mongodb/mongo.log

  • Windows: 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