OPTIONS

Install MongoDB Enterprise on Red Hat Enterprise or CentOS

Overview

Use this tutorial to install MongoDB Enterprise on Red Hat Enterprise Linux or CentOS Linux. The tutorial uses .rpm packages to install.

Packages

MongoDB provides packages of the officially supported MongoDB Enterprise builds in it’s own repository. This repository provides the MongoDB Enterprise distribution in the following packages:

Control Scripts

The mongodb-enterprise package includes various control scripts, including the init script /etc/rc.d/init.d/mongod.

The package configures MongoDB using the /etc/mongod.conf file in conjunction with the control scripts.

As of version 2.6.3, there are no control scripts for mongos. The mongos process is used only in sharding. You can use the mongod init script to derive your own mongos control script.

Install MongoDB Enterprise

When you install the packages for MongoDB Enterprise, you choose whether to install the current release or a previous one. This procedure describes how to do both.

1

Configure repository.

Create an /etc/yum.repos.d/mongodb-enterprise.repo file so that you can install MongoDB enterprise directly, using yum.

Use the following repository file to specify the latest stable release of MongoDB enterprise.

[mongodb-enterprise]
name=MongoDB Enterprise Repository
baseurl=https://repo.mongodb.com/yum/redhat/$releasever/mongodb-enterprise/stable/$basearch/
gpgcheck=0
enabled=1

Use the following repository to install only versions of MongoDB for the 2.6 release. If you’d like to install MongoDB Enterprise packages from a particular release series, such as 2.4 or 2.6, you can specify the release series in the repository configuration. For example, to restrict your system to the 2.6 release series, create a /etc/yum.repos.d/mongodb-enterprise-2.6.repo file to hold the following configuration information for the MongoDB Enterprise 2.6 repository:

[mongodb-enterprise-2.6]
name=MongoDB Enterprise 2.6 Repository
baseurl=https://repo.mongodb.com/yum/redhat/$releasever/mongodb-enterprise/2.6/$basearch/
gpgcheck=0
enabled=1
1

Install the MongoDB Enterprise packages and associated tools.

You can install either the latest stable version of MongoDB Enterprise or a specific version of MongoDB Enterprise.

Install the latest stable version of MongoDB Enterprise.

Issue the following command:

sudo yum install mongodb-enterprise
2

Optional. Manage Installed Version

Install a specific release of MongoDB Enterprise.

Specify each component package individually and append the version number to the package name, as in the following example that installs the 2.6.1 release of MongoDB:

sudo yum install mongodb-enterprise-2.6.1 mongodb-enterprise-server-2.6.1 mongodb-enterprise-shell-2.6.1 mongodb-enterprise-mongos-2.6.1 mongodb-enterprise-tools-2.6.1

Pin a specific version of MongoDB Enterprise.

Although you can specify any available version of MongoDB Enterprise, yum will upgrade the packages when a newer version becomes available. To prevent unintended upgrades, pin the package. To pin a package, add the following exclude directive to your /etc/yum.conf file:

exclude=mongodb-enterprise,mongodb-enterprise-server,mongodb-enterprise-shell,mongodb-enterprise-mongos,mongodb-enterprise-tools

Previous versions of MongoDB packages use different naming conventions. See the 2.4 version of documentation for more information.

3

When the install completes, you can run MongoDB.

Run MongoDB Enterprise

1

Start MongoDB.

You can start the mongod process by issuing the following command:

sudo service mongod start
2

Verify that MongoDB has started successfully

You can verify that the mongod process has started successfully by checking the contents of the log file at /var/log/mongodb/mongod.log.

You can optionally ensure that MongoDB will start following a system reboot by issuing the following command:

sudo chkconfig mongod on
3

Stop MongoDB.

As needed, you can stop the mongod process by issuing the following command:

sudo service mongod stop
4

Restart MongoDB.

You can restart the mongod process by issuing the following command:

sudo service mongod restart

You can follow the state of the process for errors or important messages by watching the output in the /var/log/mongo/mongod.log file.

5

Begin using MongoDB.

To begin using MongoDB, see Getting Started with MongoDB. Also consider the Production Notes document before deploying MongoDB in a production environment.