• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to Install and Configure MongoDB on Oracle Linux 8.8

  • 00:42 cat /etc/os-release
  • 00:56 vim /etc/yum.repos.d/mongodb.repo
  • 01:28 yum install mongodb-org
  • 02:33 systemctl start mongod
  • 02:47 systemctl enable mongod
  • 03:02 systemctl status mongod
  • 03:15 mongod --version
  • 03:29 mongo
  • 03:40 use mydb;
  • 03:55 db.createUser
  • 05:11 db.getUsers()
  • 05:33 db.dropUser('user1')
  • 06:00 db.dropDatabase()
  • 06:28 mongo
  • 06:34 use admin;
  • 06:46 db.createUser
  • 08:20 mongo -u user1 -p --authenticationDatabase admin
{{postValue.id}}

To Install And Configure MongoDB On Oracle Linux 8.8

Introduction

MongoDB is a NoSQL database that provides high performance, high availability, and automatic scaling. NoSQL database means it does not support SQL to retrieve or manipulate the stored data. MongoDB doesn’t store data in tables instead it stores data in a document structure similar to JSON.

Installation Steps:

Step 1: Check the Oracle Linux Version by using the below command

[root@linuxhelp]# cat /etc/os-release
NAME="Oracle Linux Server"
VERSION="8.8"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="8.8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Oracle Linux Server 8.8"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:8:8:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://github.com/oracle/oracle-linux"
ORACLE_BUGZILLA_PRODUCT="Oracle Linux 8"
ORACLE_BUGZILLA_PRODUCT_VERSION=8.8
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=8.8

Step 2: Create MongoDB Repository by using the below command

[root@linuxhelp]# vim /etc/yum.repos.d/mongodb.repo
[mongodb-org-5.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/5.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-5.0.asc

Step 3: Install MongoDB by using the below command

[root@linuxhelp]# yum install mongodb-org
MongoDB Repository                                    7.0 kB/s | 2.5 kB     00:00    
Installing:
 mongodb-org                        x86_64   5.0.9-1.el8      mongodb-org-5.0    11 k
Installing dependencies:
  mongodb-org-shell                  x86_64   5.0.9-1.el8      mongodb-org-5.0    15 M
 mongodb-org-tools                  x86_64   5.0.9-1.el8      mongodb-org-5.0    11 k
Total download size: 150 M
Installed size: 562 M
Downloading Packages:
Installed:
  mongodb-database-tools-100.5.2-1.x86_64                                             
  mongodb-mongosh-1.5.0-1.el8.x86_64                                                
  mongodb-org-shell-5.0.9-1.el8.x86_64                                                
  mongodb-org-tools-5.0.9-1.el8.x86_64                                                
Complete!

Step 4: Start the MongoDB service by using the below command

[root@linuxhelp ~]# systemctl start mongod

Step 5: Enable the MongoDB service by using the below command

[root@linuxhelp ~]# systemctl enable mongod

Step 6: Check the status of MongoDB service by using the below command

[root@linuxhelp ~]# systemctl status mongod
● mongod.service - MongoDB Database Server
   Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor pres>
   Active: active (running) since Wed 2023-08-23 03:07:54 IST; 26s ago
     Docs: https://docs.mongodb.org/manual
 Main PID: 110937 (mongod)
   Memory: 144.6M
   CGroup: /system.slice/mongod.service
           └─110937 /usr/bin/mongod -f /etc/mongod.conf
Aug 23 03:07:54 linuxhelp systemd[1]: Started MongoDB Database Server.
Aug 23 03:07:55 linuxhelp mongod[110937]: {"t":{"$date":"2023-08-22T21:37:54.99>

Step 7: Check the MongoDB Version by using the below command.

root@linuxhelp]# mongod --version
db version v5.0.9

Step 8: Connect to the MongoDB server and Create, Drop Database and User using the below command

[root@linuxhelp linuxhelp]# mongo
MongoDB shell version v5.0.9
 To Create Database use the below command 
> use mydb;
switched to db mydb

To create a user for mydb database with read and write access 
> db.createUser(
... {
... user:"user1",
... pwd:"123456",
... roles:["readWrite"]
... }
... )
Successfully added user: { "user" : "user1", "roles" : [ "readWrite" ] }

List the mydb database users by executing the below command
> db.getUsers();
[
	{
		"_id" : "mydb.user1",
		"userId" : UUID("83757547-4853-46e5-9c35-8f0cfa49e5f2"),
		"user" : "user1",
		"db" : "mydb",
		"roles" : [
			{
				"role" : "readWrite",
				"db" : "mydb"
			}
		],
		"mechanisms" : [
			"SCRAM-SHA-1",
			"SCRAM-SHA-256"
		]
	}
]
To Drop a User
> db.dropUser('user1')
true

Drop the newly created database as follows
> db.dropDatabase()
{ "ok" : 1 }

Step 9: Create a user with admin privileges using the below command

[root@linuxhelp linuxhelp]# mongo
MongoDB shell version v5.0.9
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
---
> 
> use admin;
switched to db admin
> 
> db.createUser(
... {
... user:"user1",
... pwd:"123456",
... roles:[{role:"root",db:"admin"}]
... }
... )
Successfully added user: {
	"user" : "user1",
	"roles" : [
		{
			"role" : "root",
			"db" : "admin"
		}
	]
}
> 
> exit
Bye

Step 10: Login to the MongoDB server using the user1 credentials

[root@linuxhelp linuxhelp]# mongo -u user1 -p --authenticationDatabase admin
MongoDB shell version v5.0.9
Enter password: 
connecting to: mongodb://127.0.0.1:27017/?authSource=admin&compressors=disabled&gssapiServiceName=mongodb
---
> exit
Bye

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to install and Configure MongoDB on Oracle Linux 8.8. Your feedback is much welcome.

Tags:
sebastian
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

What is MongoDB?

A

MongoDB is a general-purpose, document-based, distributed data platform built for modern application developers and for the cloud. No data platform is more productive to use

Q

What are the disadvantages of MongoDB?

A

Data size in MongoDB is typically higher

Q

Can MongoDB lose data?

A

MongoDB can lose data if you use the default settings.

Q

Is MongoDB a database?

A

MongoDB is a non-relational document database

Q

Can I store objects in MongoDB?

A

In MongoDB, you can store any object without having to worry about the particular fields that compose this object and how to store them

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Luke ?
workbench for debian

I am using workbench in CentOS whereas now I need to use Debian Operating system so could you please help to install and use in Debian?

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.