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:
[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:
$ sudo yum install -y mongodb-org
After installation completing, you should start MongoDB service:
$ sudo systemctl start mongod
After that you can connect MongoDB shell just typing:
If you are getting an warning like this :
** 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.
$ mongod soft nproc 32000
Note: If you want to start mongoDB deamon with system, you should enable it by using systemctl utility :
$ sudo systemctl enable mongod