Install MongoDB 6.0 Server on Debian 12 or 11 Linux

Here we are using the official repository to install MongoDB 6.0 server and client on Debian 11 to manage local or remote Databases with the help of a command terminal.

MongoDB is a database based on a non-relational document model. As a so-called NoSQL database (NoSQL = Not-only-SQL) it differs fundamentally from conventional relational databases such as Oracle, MySQL, or the Microsoft SQL Server. The name is MongoDB is derived from the English word “humongous”, which roughly means “gigantic”.

Steps to install MongoDB Server & client on Debian 11

During this article, the official repository of MongoDB is available for Debian 11 Bullseye, hence we can use the same.

1. Add MongoDB Repository on Debian 12/11

As we know the MongoDB packages are not available to install directly from the base repository of Debian 11 or 10., therefore, we need to add the official one offered by the developers of this NoSQL database.

echo "deb http://repo.mongodb.org/apt/debian bullseye/mongodb-org/6.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list

2. Integrate the MongoDB GPG key

To ensure the packages we will receive to install this database on our Linux are from an authentic source. Add the GPG signed key by the developers of the Database server.

curl -sSL https://www.mongodb.org/static/pgp/server-6.0.asc  -o mongoserver.asc
gpg --no-default-keyring --keyring ./mongo_key_temp.gpg --import ./mongoserver.asc
gpg --no-default-keyring --keyring ./mongo_key_temp.gpg --export > ./mongoserver_key.gpg
sudo mv mongoserver_key.gpg /etc/apt/trusted.gpg.d/

3. Run system update

On your Debian 11 or 10 command terminal run the system update command to make sure all the existing packages are up to date.

sudo apt update

4. Install MongoDB 6.0 on Debian

That’s it. We have configured already what we need to install “database-tools, mongosh, extra tools, mongos; database server and shell” on our Debian 11 or 10 Linux.

Hence, just run a simple command:

sudo apt install mongodb-org
Install MongoDB 6 on Debian 11 Bullseye

5. Start and Enable the MongoDB service

Once the installation is completed, let’s enable and also start the service of the Database server, so that we don’t need to run it again and again with system boot.

sudo systemctl enable --now mongod

to check the status:

sudo systemctl status mongod --no-pager -l
Enable MongoDB Service

6. Check the installed version

To confirm what version is exactly installed on your system, run:

mongod --version
Check MongoDB Server Version on Linux

To get the Mongo command line help, simply type:

mongos --help

To know- how to use the database commands, see the official documentation. 

7. How to Update

If any security update will be available for MongoDB version 6.0 then to get that the user just needs to run the system update command.

sudo apt update && sudo apt upgrade

8. Uninstall or Remove

Well, those who are not interested anymore in MongoDB and don’t require it, can remove the same using the below-given command:

sudo apt autoremove --purge mongodb-org

Other Articles:

How to install MongoDB 5.0 Server on Debian 11 Bullseye
Install MongoDB Compass GUI on AlmaLinux or Rocky Linux 8
Install MongoDB Server on Alpine Linux
How to install MongoDB Server on Linux mint 18 | 19 | 20

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.