Install MongoDB
This tutorial is being updated for Ubuntu 26.04 LTS. The official installation guide for MongoDB 8.0 Community Edition does not currently list this Ubuntu release as supported.
Do not run the following installation commands on Ubuntu 26.04 LTS. They still use the noble package source and must be updated to an officially supported MongoDB version and repository first. Simply replacing noble with resolute is not sufficient.
__$ sudo apt-get update
__$ sudo apt-get install -y gnupg curl
__$ curl -fsSL https://pgp.mongodb.com/server-8.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg --dearmor
__$ 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
__$ sudo apt-get update
__$ sudo apt-get install -y mongodb-org
Let's open the main configuration file of MongoDB with less.
__$ sudo less /etc/mongod.conf
/etc/mongod.conf
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: /var/lib/mongodb
journal:
enabled: true
# engine:
# wiredTiger:
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1
# how the process runs
processManagement:
timeZoneInfo: /usr/share/zoneinfo
#security:
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options:
#auditLog:
#snmp:
In the output we can see:
- Data:
/var/lib/mongodb - Log file:
/var/log/mongodb/mongod.log - Address:
127.0.0.1 - Port:
27017
We can retrieve the version with --version:
__$ mongosh --version