How to install MongoDB 5.0 Server on Debian 11 Bullseye

Learn the simple steps to install MongoDB 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 MongoDB is derived from the English word “humongous”, which roughly means “gigantic”.

MongoDB Server & client installation on Debian 11 or 10 Linux

During this article, the official repository of MongoDB is only available for Debian 10 Buster, however, we can use the same on Debian 11 Bullseye as well to install the same.

1. Add MongoDB Repository on Debian 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 buster/mongodb-org/5.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.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-5.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. Command to Install MongoDB on Debian 11 or 10

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

 

5. Start and Enable 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

Start MongoDB service on Debian 11

 

6. Check the installed version

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

mongod --version

Command to check mongo database server version

 

To get the mongo command line simply type:

mongo

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

 

Uninstall or Remove

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

sudo apt remove mongodb-org

 

Other Articles:

  1. Install MongoDB Compass GUI in Ubuntu 20.04 LTS Linux
  2. How to install MariaDB 10 on Debian 11 Bullseye Linux
  3. Install Chrome browser on Debian 11 Bullseye Linux

 

 

 

Leave a Reply

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