From the terminal, install gnupg and curl if they are not already available
sudo apt-get install gnupg curl |
To import the MongoDB public GPG key, run the following command:
curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg --dearmor |
Create a /etc/apt/sources.list.d/mongodb-org-7.0.list file for MongoDB
echo "deb[signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg] http://repo.mongodb.org/apt/debian bookworm/mongodb-org/7.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list |
Issue the following command to reload the local package database
sudo apt-get update |
Install the MongoDB packages
sudo apt-get install -y mongodb-org |
Start the mongod process by issuing the following command
sudo systemctl start mongod |
Verify that MongoDB has started successfully
sudo systemctl status mongod |