[2019]How to Install MongoDB 4.0 On CentOS 7

0
385
Install MongoDB 4 On CentOS 7

How to Install MongoDB 4.0 On CentOS 7:-

Introduction :-

Most of you must be aware of MongoDB. Mongo DB is one of the most used NOSQL database currently in market . It uses a JSON formatted data structure as compared to relational databases . Now a days most of the applications uses mongo db as a database . its light weight and highly scalable and doesn’t involve any complex relationships. This tutorial guides you through How to Install MongoDB 4.0  on a CentOS 7 server.

Recently one of my friends had issues Configuring MongoDB 4.0 on CentOS 7. I thought to help him and write down the steps.

Let me also list down the problems he faced while Installing MongoDB 4.0 on CentOS 7.

  1. Installing On CentOS requires the addition of repository.
  2. Enable MongoDB authentication and admin user.
  3. Enable MongoDB access outside of your VM using the IP address and Port.

How to Add the MongoDB Repository in CentOS

You must log in using the root user or create a root user if you want. As you will be having a fresh Cent OS , you need to add the Mongo repo.

Install MongoDB 4.0 On CentOS 7

We now need to configure Yum, Navigate to /etc/yum.repos.d/ directory. Create a repository file as below.

Copy the configuration below save and exit.

Installing MongoDB 4.0 using yum:-

It will ask you to download MongoDB packages, please press Y and Continue.

Once the installation is completed, start your MongoDB service using the following command.

Restart the MongoDB service using the following command.

How to Create MongoDB admin User:-

We are creating one admin user with credential admin/admin123 .Lets login to mongo using mongo shell.

Switch to the admin database

Create an admin user below in mongo.

Follow my previous Post for rest of the Steps .

Enable MongoDB access using Machine Ip address:-

Let’s try to access MongoDB using machine IP.

You will get a connection error. Now we need to enable access using an IP address. Navigate to /etc/mongo.conf  find out the line where bindIp is present.

Update your IP address, as you can see I have entered by address as 192.168.1.19 separated by a comma.

rerun the command using the IP address, you will be logged in inside Mongo shell.

Install MongoDB 4.0 On CentOS 7

 

References :- Big Thanks to all the links and Videos that helped me doing this on a Fresh CentOs .

  1. No Internet Connection On CentOS 7 – Youtube.
  2. Lan Configuration CentOS – Youtube.
  3. Install MongoDB – Mongodb.com.
  4. MongoDb Security CheckList .

 

 

 

 

LEAVE A REPLY

Please enter your comment!
Please enter your name here