Navigation
This version of the documentation is archived and no longer supported.

Install MongoDB on Red Hat Enterprise or CentOS Linux

Note

The downloads-distro.mongodb.org host has been decommissioned. To get the binaries for MongoDB 2.6 (which has reached end of life on October 2016):

Once downloaded, you can follow the instructions on Install MongoDB on Linux Systems.

Considerations

For production deployments, always run MongoDB on 64-bit systems.

Configure SELinux

Important

You must configure SELinux to allow MongoDB to start on Red Hat Linux-based systems (Red Hat Enterprise Linux or CentOS Linux).

To configure SELinux, administrators have three options:

Note

All three options require root privileges. The first two options each requires a system reboot and may have larger implications for your deployment.

  • Disable SELinux entirely by changing the SELINUX setting to disabled in /etc/selinux/config.

    SELINUX=disabled
    
  • Set SELinux to permissive mode in /etc/selinux/config by changing the SELINUX setting to permissive .

    SELINUX=permissive
    

    Note

    You can use setenforce to change to permissive mode; this method does not require a reboot but is not persistent.

  • Enable access to the relevant ports (e.g. 27017) for SELinux if in enforcing mode. See Default MongoDB Port for more information on MongoDB’s default ports. For default settings, this can be accomplished by running

    semanage port -a -t mongod_port_t -p tcp 27017
    

    Warning

    On RHEL 7.0, if you change the data path, the default SELinux policies will prevent mongod from having write access on the new data path if you do not change the security context.

You may alternatively choose not to install the SELinux packages when you are installing your Linux operating system, or choose to remove the relevant packages. This option is the most invasive and is not recommended.