Database/NoSQL

MongoDB 7.0 설치

lumination 2025. 4. 16. 11:19

TL;DR - Install Mac, Ubuntu


1. Mac OS

brew tab mongodb/brew

brew install mongodb-community@7.0

brew services start mongodb-community@7.0

brew services list

Name                  Status  User File
mongodb-community@7.0 started nhn  ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community@7.0.plist

 

mongosh

Current Mongosh Log ID:	67ff12bbd129c363bc1041e5
Connecting to:		mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+2.5.0
Using MongoDB:		7.0.19
Using Mongosh:		2.5.0

For mongosh info see: https://www.mongodb.com/docs/mongodb-shell/


To help improve our products, anonymous usage data is collected and sent to MongoDB periodically (https://www.mongodb.com/legal/privacy-policy).
You can opt-out by running the disableTelemetry() command.

------
   The server generated these startup warnings when booting
   2025-04-16T11:15:00.990+09:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
------

 

2. Ubuntu 22.04

참고: https://jjeongil.tistory.com/2463

sudo apt update
sudo apt install gnupg wget apt-transport-https ca-certificates software-properties-commonsudo apt update
sudo apt install gnupg wget apt-transport-https ca-certificates software-properties-common

# MongoDB 리포지토리의 GPG 키
wget -qO- \
  https://pgp.mongodb.com/server-7.0.asc | \
  gpg --dearmor | \
  sudo tee /usr/share/keyrings/mongodb-server-7.0.gpg >/dev/null
  
# 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 -a /etc/apt/sources.list.d/mongodb-org-7.0.list
  
sudo apt update
sudo apt install mongodb-org
sudo systemctl enable --now mongod

# 설치 확인
mongosh --eval 'db.runCommand({ connectionStatus: 1 })'