MongoDB, one of the popular NoSQL database, is available for recently released CentOS 8. Let’s check out how to get it installed. Update – if you are looking for production-ready managed MongoDB then you should check out these hosting platforms.

Installing on CentOS/RHEL 8

Support for CentOS 8 is available from MongoDB 4.2.1. This means you can’t install the previous MongoDB version, like the 3.x series. So, if you are currently running MongoDB (lower than 4.2.1 version) on CentOS 7 and thinking to migrate the server, then you also got to consider upgrading MongoDB. I assume you have logged in to the server with a root or sudo privilege account.

Create a file /etc/yum.repos.d/mongodb-org-4.2.repo with the following content

Note: above, I am getting MongoDB 4.2 installed. However, if you need to install different versions, then update the 4.2 info with the desired ones. You can refer to the official MongoDB repo page to find out the available version.

and then, install using yum command

It will take a few seconds, and once done, you should see something like below. Let’s verify the version to ensure it has installed. There you go! MongoDB is successfully installed. Next, explore MongoDB commands to learn more.