Installing MongoDB 6.0 on RHEL 7.9

Using RPM repository

# Create the MongoDB repository:
cat > /etc/yum.repos.d/mongodb-org-6.0.repo << EOF
[mongodb-org-6.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/7/mongodb-org/6.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://pgp.mongodb.com/server-6.0.asc
EOF

# Install MongoDB:
yum install -y mongodb-org

# Start MongoDB:
systemctl enable mongod
systemctl start mongod
systemctl status mongod

Management

Default Directory Paths:

/var/lib/mongo (the data directory)
/var/log/mongodb (the log directory)

~]# mongosh

> use demo
> db.t1.insertOne({id: 1, name:'jove'})
> db.t1.find({})

Reference

https://www.mongodb.com/docs/
https://www.mongodb.com/try/download/community