The most popular database managers are the SQL type, but nowadays there are other types of database managers that developers are using more and more, I mean the NoSQL type. These database managers, based on reference documents, are a major component of mobile applications, combined with the stability of OpenSUSE make a safe bet. So, today I’ll show you how to install MongoDB on OpenSUSE 15.
MongoDB is one of the most popular NoSQL database managers in the world. Unlike managers like MySQL or PostgreSQL, it saves your records in documents so they are more understandable and operations faster to do. As I said, it is incredibly popular with developers.
So, let’s install MongoDB on OpenSUSE.
1. Upgrade the system
I always recommend everyone to update the system before starting any critical installation. Upgrading the system helps make it more stable and efficient.
:~$ sudo zyyper up
Now that the system is up to date, it is more stable and ready to start installing MongoDB.
2. Install MongoDB on OpenSUSE
MongoDB is not included in the official repositories of the distribution because it is a component that not everyone uses. Therefore, it is necessary to add the databases OpenSUSE repository to make the installation easy and above all secure.
So, run this command.
:~$ sudo zypper addrepo https://download.opensuse.org/repositories/server:database/openSUSE_Leap_15.0/server:database.repo
In this command, you are adding the external repository. Now you need to refresh the cache of the repositories.
:~$ sudo zypper refresh
Finally, install MongoDB.
:~$ sudo zypper in mongodb
And that it.
3. Use MongoDB to test the installation
The best way to verify that the installation has been successful is to use MongoDB. So, we will.
First, start the service.
:~$ sudo systemctl start mongodb
If you want MongoDB starts at the system boot:
:~$ sudo systemctl enable mongodb
Now, check the service status to see it is properly running.
:~$ sudo systemctl status mongodb
Access the MongoDB console and create an administrator user. Because by default, MongoDB does not create a user.
:~$ mongo
use admin db.createUser({ user: "root", pwd: "your_password", roles: [ "root" ] }) exit
Note: Replace your_password with your real password.
Next time, you can log in with admin user:
:~$ mongo --authenticationDatabase admin -u root -p
Note: When logging in you must specify the database to which the user has permission. In this case, root has permissions on the admin database. If you don’t specify it during logging you won’t be able to access it.
And that’s it. MongoDB is running correctly on your OpenSUSE 15.
Conclusion
As you can see the installation is really simple and only requires a few minutes of dedication. MongoDB is so powerful in its area that it makes it the most logical option within NoSQL databases.
Please share this post with your friends.