MongoDB

Installing MongoDB on Different Platforms

Installing MongoDB on Different Platforms

  • Windows:
    1. Download MongoDB: Go to the MongoDB Download Center and download the Windows installer.
    2. Run Installer: Execute the downloaded .msi file and follow the installation wizard.
    3. Setup Environment: Add MongoDB’s bin directory to the PATH environment variable.
    4. Start MongoDB: Open Command Prompt and run mongod to start the server.
  • macOS:
    1. Install Homebrew (if not installed): Run /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)".
    2. Install MongoDB: Run brew tap mongodb/brew and then brew install mongodb-community.
    3. Start MongoDB: Use brew services start mongodb-community.
  • Linux:
    1. Import MongoDB Public Key: Run wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -.
    2. Create List File: Run echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu focal 10gen" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list.
    3. Install MongoDB: Run sudo apt-get update and then sudo apt-get install -y mongodb-org.
    4. Start MongoDB: Use sudo systemctl start mongod.

Setting up MongoDB Compass

  • Download MongoDB Compass: Visit the MongoDB Compass Download Page and download the appropriate version for your OS.
  • Install Compass: Follow the installation instructions for your platform.
  • Connect to MongoDB: Open Compass and connect to the MongoDB server using the default connection settings (mongodb://localhost:27017).

Leave a Reply

Your email address will not be published. Required fields are marked *