Own Machine
This guide explains how to install MongoDB Community Edition on Ubuntu using the official MongoDB repository.
Update Your System
sudo apt update && sudo apt upgrade -yInstall Required Dependencies
sudo apt install -y gnupg curlImport MongoDB Public GPG Key
curl -fsSL https://pgp.mongodb.com/server-7.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg --dearmorAdd the MongoDB Repository
Ubuntu 24.04 (Noble)
echo "deb [ arch=amd64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.listUbuntu 22.04 (Jammy)
echo "deb [ arch=amd64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.listUbuntu 20.04 (Focal)
Update Package List
Install MongoDB
Start MongoDB Service
Check Service Status
Test MongoDB
Optional: Enable Authentication (Recommended for Production)
Optional: Allow Remote Connections
Last updated