Installing MongoDB depends on the operating system you’re using. Below are the instructions for installing MongoDB on Ubuntu (Linux), macOS, and Windows.
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu $(lsb_release -cs)/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
sudo apt update
sudo apt install -y mongodb-org
sudo systemctl start mongod
sudo systemctl status mongod
sudo systemctl enable mongod
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew tap mongodb/brew
brew install mongodb-community@6.0
brew services start mongodb/brew/mongodb-community
brew services list
bin
directory (e.g., C:\Program Files\MongoDB\Server\6.0\bin
).mongod
mongo
/etc/mongod.conf
on Linux or in the installation directory on other platforms. You can edit this file to modify server settings, such as port, bind IP, and storage options.mongod
process to start the server and mongo
to interact with it. On Windows and Linux, you can start and stop MongoDB as a service to ensure that it runs in the background.This will connect to the default MongoDB instance.