29.9 C
Texas
angeloma
Senior Writer and partner

How to install MongoDB on OpenSUSE 15?

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.

- Advertisement -
:~$ sudo zyyper up

1.- Upgrade the system
1.- Upgrade the system

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

2.- Add the external repo
2.- Add the external repo

In this command, you are adding the external repository. Now you need to refresh the cache of the repositories.

:~$ sudo zypper refresh

3.- Refresh the repository cache
3.- Refresh the repository cache

Finally, install MongoDB.

:~$ sudo zypper in mongodb

4.- Install MongoDB on OpenSUSE
4.- Install MongoDB on OpenSUSE

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

5.- Start the MongoDB service
5.- Start the MongoDB service

Now, check the service status to see it is properly running.

:~$ sudo systemctl status mongodb

6.- Check the service status
6.- Check the service status

Access the MongoDB console and create an administrator user. Because by default, MongoDB does not create a user.

:~$ mongo

7.- MongoDB shell
7.- MongoDB shell

use admin 
  db.createUser({ 
  user: "root", 
  pwd: "your_password", 
  roles: [ "root" ] 
  }) 
  exit

8.- Creating a root user
8.- Creating a root user

Note: Replace your_password with your real password.

Next time, you can log in with admin user:

:~$ mongo --authenticationDatabase admin -u root -p

 

9.- MongoDB shell using password
9.- MongoDB shell using a password

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.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article