Essetee's Website

Install MongoDB Community Edition on Debian 12 Bookworm

Import the public key.

sudo apt install gnupg curl

I have bash script installers for debian and ubuntu.

Download for Debian

Download for Ubuntu

Free to download or keep following the howto.

To import the MongoDB public GPG key, run the following command:

curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \
   sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg \
   --dearmor

Create the list file for Debian 12 alias Bookworm:

Visit the link for newer versions or for the next debian dist upgrade.
Available debian repos.

echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] \
http://repo.mongodb.org/apt/debian bookworm/mongodb-org/8.0 main" | 
sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list

Create the list file for ubuntu users:

Visit the link for newer versions or for the next ubuntu dist upgrade.
Available ubuntu repos.

echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] \
https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | 
sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list

Reload the apt package database.

sudo apt update

To install the latest stable version, issue the following command:

sudo apt install -y mongodb-org

Start the MongoDB server.

sudo systemctl start mongod

Staus of the MongoDB server.

sudo systemctl status mongod

Be sure that the MongoDB starts at system reboot

sudo systemctl enable mongod

Restart the MongoDB server.

sudo systemctl restart mongod

Enter the MongoDB shell

mongosh
Current Mongosh Log ID:	680a168202926ce180d861df
Connecting to:		mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+2.5.0
Using MongoDB:		8.0.8
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-24T12:41:52.783+02:00: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine. See http://dochub.mongodb.org/core/prodnotes-filesystem
   2025-04-24T12:41:52.900+02:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
   2025-04-24T12:41:52.900+02:00: For customers running the current memory allocator, we suggest changing the contents of the following sysfsFile
   2025-04-24T12:41:52.900+02:00: We suggest setting the contents of sysfsFile to 0.
   2025-04-24T12:41:52.900+02:00: vm.max_map_count is too low
   2025-04-24T12:41:52.901+02:00: We suggest setting swappiness to 0 or 1, as swapping can cause performance problems.
------

test>