So I am going to show you how to install MongoDB on CentOS7 and RHEL7 today.

First thing we need to do is to add the MongoDB repo to yum.

Adding MongoDB repo to Yum

vim /etc/yum.repos.d/mongodb.repo

Next insert the following lines into the repo file you just created.

name=MongoDB repo

After you saved the file with the repo information you will need to install the MongoDB packages using yum.

Installing MongoDB packages

yum install mongodb-org

Now that you have MongoDB packages installed you will need to start the MongoDB service using systemd.

Starting MongoDB Server

sudo systemctl start mongod.service

Now lets check to see if MongoDB is running and also open up the firewall so we can access it.

Checking to see if mongoDB is running

ps -ef  |  grep   mongo

Opening up the ports on the firewall

sudo firewall-cmd --zone=public --add-port=27017/tcp --permanent
sudo firewall-cmd --reload

Now that’s it. have fun with MongoDB.


If you have any questions or comments please email me at


13 October 2014