Following are the steps to install the MongoDB in centOS:
Step - 1: Login to the system via SSH.
Step - 2: Create a MongoDB repository file using an editor as below.
nano /etc/yum.repos.d/mongodb.repo
Step -3: If you are running a 64-bit system, add the below information to the file you have created.
[mongodb]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1
Step - 4: Press CTRL+x to exit and press Y to save the file
Step - 5: It will ask to confirm filename and path. Just press enter.
Step - 6: As a best practice, we should also update our package using below command.
yum -y update
Step - 7: Now, run below command to install MongoDB.
yum -y install mongodb-org mongodb-org-server
That's it. MongoDB is installed.