This document provides guidance for MemSys project developers on installing and configuring MongoDB directly on macOS, Windows, and Linux.
Please choose the installation method corresponding to your operating system.
We recommend using Homebrew for installation. Homebrew is a package manager for macOS that greatly simplifies the software installation process.
-
Install Homebrew (if not already installed):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" -
Add MongoDB's Homebrew Tap:
brew tap mongodb/brew
-
Install MongoDB:
brew install mongodb-community
- Go to the MongoDB Community Server Download Page.
- Select the latest version
MSIpackage and download it. - Run the installer. During the installation process, be sure to check the "Install MongoDB Compass" option to install the graphical management tool at the same time.
- Follow the wizard to complete the installation. The installer will automatically set up MongoDB as a Windows service, which will start by default on boot.
If you use Chocolatey, you can install it by running the following command:
choco install mongodb-
Import MongoDB's GPG Key:
sudo apt-get install gnupg curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | \ sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg \ --dearmor -
Create a List File for MongoDB:
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu $(lsb_release -cs)/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
-
Update the Local Package Database and Install MongoDB:
sudo apt-get update sudo apt-get install -y mongodb-org
If you did not select the bundled installation during the Windows setup, or if you are a macOS/Linux user, you can install Compass separately.
-
macOS:
brew install --cask mongodb-compass
-
Windows: Go to the MongoDB Compass Download Page, download the
MSIpackage, and execute it. -
Linux (Ubuntu): Go to the MongoDB Compass Download Page, download the
debformat package, and then install it with the following command (please replace the filename with the actual name of the file you downloaded):sudo dpkg -i mongodb-compass_x.x.x_amd64.deb
-
macOS (via Homebrew):
brew services start mongodb-community
-
Windows: If you installed via the official installer, MongoDB will be registered as a Windows service and run automatically. You can find and manage it in the "Services" application.
-
Linux (Ubuntu):
sudo systemctl start mongod # Enable auto-start on boot sudo systemctl enable mongod
You can check the service status with
sudo systemctl status mongod.
Regardless of the operating system, open your installed MongoDB Compass. It will usually automatically detect your locally running MongoDB instance. You just need to click the "Connect" button and use the default connection string mongodb://localhost:27017 to connect successfully.
To allow the MemSys application to connect to the local MongoDB, you need to configure the project's environment variables.
-
First, in the project's root directory, copy the
env.templatefile to.env(if you haven't already):cp env.template .env
-
Open the
.envfile and find the MongoDB configuration section. Since a local installation of MongoDB does not have user authentication enabled by default, you need to make the following changes:# =================== # MongoDB Configuration # =================== MONGODB_HOST=127.0.0.1 MONGODB_PORT=27017 MONGODB_USERNAME= MONGODB_PASSWORD= MONGODB_DATABASE=memsys MONGODB_URI_PARAMS=
Note: Leave
MONGODB_USERNAMEandMONGODB_PASSWORDblank, and also setMONGODB_URI_PARAMSto empty. You can customizeMONGODB_DATABASE; here we continue to usememsys.
Now, your development environment is configured, and the MemSys application can successfully connect to the locally running MongoDB instance.