How Do You Install MongoDB on RHEL 8.x?

Problem scenario
You want to install MongoDB on a RHEL server. What do you do?

Solution
1. Create this file: /etc/yum.repos.d/mongodb-org-4.4.repo

[mongodb-org-4.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.4.asc
  1. Run these commands:
sudo yum -y update
sudo yum -y install mongodb-org
  1. Test the installation by running this: mongod -version

If you are using Debian or Ubuntu, see this posting.

Leave a comment

Your email address will not be published. Required fields are marked *