×


Install MongoDB on openSUSE Leap 15.3 - Step by step guide ?

MongoDB is one of the widely popular document-oriented NoSQL databases. It is designed to store a massive amount of data while also allowing you to work with that data in a very efficient manner. It is used in the development of many modern web applications. It is open-source and written in C++. MongoDB supports a variety of Linux platforms including Ubuntu, Debian, CentOS, Linux Mint, Fedora and openSUSE. It also supports Windows and MacOS.

Here at Ibmi Media, we shall look into steps to install MongoDB on openSUSE Leap 15.3 Operating System.


Complete procedure of installing MongoDB on openSUSE

1. To begin, you will need to add the GPG key for the MongoDB repository. Execute the command below to add the MongoDB repository's GPG key to your system:

$ sudo rpm --import https://www.mongodb.org/static/pgp/server-5.0.asc

2. Add MongoDB repositoryby running the below command:

$ sudo zypper addrepo --gpgcheck "https://repo.mongodb.org/zypper/suse/15/mongodb-org/5.0/x86_64/" mongodb

If the repository is successfully added, you will be notified in the output.

3. Now in order to install MongoDB on your openSUSE system, execute the command below:

$ sudo zypper install mongodb-org

This will list the MongoDB package and all the dependencies that will be installed alongside it. To continue the operation, hit y and then Enter key.

After MongoDB is installed, you can initiate its service through the command below:

$ sudo systemctl start mongod

To verify if the service has been initiated, execute the command below:

$ sudo systemctl status mongod

If MongoDB service is started, you will see it in the output as active and running.

After the MongoDB service has been initiated, you can start using it. To start the MongoDB session, execute the below command:

$ mongosh


How to Manage MongoDB services ?

If you want to stop the MongoDB service, execute the command below:

$ sudo service mongod stop

To restart the MongoDB service, execute the command below:

$ sudo service mongod restart

If you want to start the MongoDB service automatically at boot, execute the command below:

$ sudo service mongod enable


How to Uninstall MongoDB from openSUSE system ?

If you no longer need MongoDB installed on your system, you can uninstall it as follows:

1. First, you will need to stop the MongoDB service by executing the command below:

$ sudo service mongod stop

2. To find the list of MongoDB packages that are installed on your openSUSE system, execute the command below:

$ rpm -qa | grep mongodb-org

It will list all the MongoDB packages installed on your system.

3. To remove all the MongoDB packages, execute the command below:

sudo zypper remove mongodb-org-*

4. If you also want to remove MongoDB log files and databases, execute the command below:

$ sudo rm -r /var/lib/mongo
$ sudo rm -r /var/log/mongodb


[Need help in fixing MongoDB issues ? We can help you. ]


Conclusion

This article covers how to install MongoDB on openSUSE OS through the MongoDB repository.