Skip to main content
Skip table of contents

How to Install MongoDB on Centos 7 Instance

MongoDB is a free and open-source NoSQL document database.

We will begin with adding MongoDB repositories.

Create a /etc/yum.repos.d/mongodb-org-3.6.repo file so that you can install MongoDB directly, using yum

CODE
[mongodb-org-3.6]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.6/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.6.asc

You can install latest stable version of MongoDB by typing:

CODE
$ sudo yum install -y mongodb-org

After installation completing, you should start MongoDB service:

CODE
$ sudo systemctl start mongod 

After that you can connect MongoDB shell just typing:

CODE
$ mongo

If you are getting an warning like this :

CODE
** WARNING: soft rlimits too low. rlimits set to 4096 processes, 64000 files. 
Number of processes should be at least 32000 : 0.5 times number of files.

You should edit /etc/security/limits.d/20-nproc.conf file by adding following line to end of the file and you should restart mongod service for applying changes. 

CODE
$ mongod soft nproc 32000

Note: If you want to start mongoDB deamon with system, you should enable it by using systemctl utility :

CODE
$ sudo systemctl enable mongod

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.