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.
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.asc2. Add MongoDB repositoryby running the below command:
$ sudo zypper addrepo --gpgcheck "https://repo.mongodb.org/zypper/suse/15/mongodb-org/5.0/x86_64/" mongodbIf 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-orgThis 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 mongodTo verify if the service has been initiated, execute the command below:
$ sudo systemctl status mongodIf 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:
$ mongoshIf you want to stop the MongoDB service, execute the command below:
$ sudo service mongod stopTo restart the MongoDB service, execute the command below:
$ sudo service mongod restartIf you want to start the MongoDB service automatically at boot, execute the command below:
$ sudo service mongod enableIf 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 stop2. To find the list of MongoDB packages that are installed on your openSUSE system, execute the command below:
$ rpm -qa | grep mongodb-orgIt 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/mongodbThis article covers how to install MongoDB on openSUSE OS through the MongoDB repository.