> ## Content Index
> Fetch the complete content index at: https://scriptcrunch.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to Install and Configure MongoDb on Redhat 7/CentOS 7
- URL: https://scriptcrunch.com/install-configure-mongodb-redhatcentos-7/
- Published: 2016-09-28T08:05:02.000Z
- Updated: 2026-06-23T08:56:18.000Z
- Author: Scriptcrunch Editorial
- Tags: Databases, Tutorials, Linux, MongoDB, Red Hat, #Migrated-1758801465347, #wp, #wp-post, #Import 2025-09-25 11:57

How do I install the latest [mongoDB](https://scriptcrunch.com/tag/mongodb/) [database](https://scriptcrunch.com/tag/databases/) server and components in Redhat 7 or a centos 7 box?

There are no Mongodb packages available in the default yum repository. You need to add the mongoDb repository and then install and configure it. Follow the [guide](https://scriptcrunch.com/tag/guides/) given below which has the steps for the same.

## Install MongoDb on Redhat 7/CentOS 7

1\. Add repository /etc/yum.repos.d/mongodb-org-3.2.repo\[mongodb-org-3.2\] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86\_64/ gpgcheck=1 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-3.2.asc2\. Install mongodb. sudo yum install -y mongodb-org3\. Set SElinux content for mongodb port, if it is in enforcing mode. You can check the SELinux status using "sestatus" command. semanage port -a -t mongod\_port\_t -p tcp 270174\. Start MongoDB service. sudo service mongod startYou can check the mongoDB logs using the following command. tail -f /var/log/mongodb/mongod.log5\. Add mongod service to boot. sudo chkconfig mongod on6\. To stop and restart mongoDB service, you can use the following commands. sudo service mongod stop sudo service mongod restart

### Enable MongoDB Remote Access

By default mongoDb can be accessed only on the installed host. If you want remote access of mongodb instance, you need to do the following configuration.

1. Open mongod.conf file

sudo vi /etc/mongod.conf

1. Search for bindIP parameter in the file, and repalace its value to 0.0.0.0 as shown below. If you want to bind the mongodb service to a specific port, you can replace 0.0.0.0 to the IP.

bindIp: 0.0.0.0

1. restart the mongod service.

sudo service mongod restart