How to install MongoDB version 4.0 on Centos 7?

MongoDB is an open-source and free Database service. It is a NoSQL Database and it is different than other Databases like MSSQL and MySQL. There is no requirement of predefined schema and data structure as it will be changed. Data will be stored in JSON-like documents in MongoDB.

Following are the steps to install MongoDB 4 on Centos 7. We belive you are logged in with root or sudo user.

  1. Add MongoDB repository to mongodb-org.repo inside the /etc/yum.repos.d/ directory using command : vi /etc/yum.repos.d/mongodb-org.repo

  2. Enter below details in mongodb-org.repo

    [mongodb-org-4.0]
    name=MongoDB Repository
    baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.0/x86_64/
    gpgcheck=1
    enabled=1
    gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc
    
  3. Once repository is enabled, install MongoDB using yum command as below.

    # sudo yum install mongodb-org
    

         You will need to press y when MongoDB ask for the GPG Key during installation.

  1. MongoDB will install the below packages as per screen capture.

      mongodb-org-mongos.x86_64 0:4.0.14-1.el6                                      
      mongodb-org-server.x86_64 0:4.0.14-1.el6                                      
      mongodb-org-shell.x86_64 0:4.0.14-1.el6                                       
      mongodb-org-tools.x86_64 0:4.0.14-1.el6 
    

          

  1. Start MongoDB and enable it to start on boot.

    sudo systemctl start mongod
    sudo systemctl enable mongod
  2. You can use mongo command to verify the installation MongoDB version.

    mongo
  • 0 Users Found This Useful

Was this answer helpful?

Related Articles

How to install Google Chrome on Ubuntu 18.04 using the Command Line?

Following are the steps to install Google Chrome using Command-Line. Edit the source.list file...

How to check Inode usage from cPanel and Command line?

Inode is a data structure that stores the information about all files created on your hosting...

How to take Backup of Exim Configuration from WHM?

EXIM comes with cPanel which is responsible for the email tranfer on the Linux server. Users can...

Do You Offer VPS with 8 vCPU Cores?

No, we do not provide VPS with 8 vCPU cores. We provide VPS with maximum 4 vCPU cores. This is...

How to Install and Configure Fail2ban on Ubuntu?

You require to protect your server from a Brute force attack from the internet. You can do it...