How to install the latest MongoDB 3.0.1 on RHEL or CentOS 7

MongoDB is an open source, document-oriented database designed with both scalability and developer agility in mind. It is classified as NoSQL because instead of storing your data in tables and rows as with a relational database, it stores in JSON-like documents with dynamic schemas. This makes it faster and easier to integrate data on certain types of applications.

MongoDB has been adopted as backend software by a number of major websites and services, including Craigslist, eBay, Foursquare, SourceForge, Brave Collective, Viacom, and the New York Times, among others. MongoDB is the most popular NoSQL database system.

Main features

Some of its main features are listed as follows:

1. Instead of taking a business subject and breaking it up into multiple relational structures, MongoDB can store the business subject in the minimal number of documents.

2. It supports search by field, range queries, regular expression searches. Queries can return specific fields of documents and also include user-defined JavaScript functions.

3. It provides high availability with replica sets.

4. It can run over multiple servers, balancing the load and/or duplicating data to keep the system up and running in case of hardware failure. Automatic configuration is easy to deploy, and new machines can be added to a running database.

5. It can be used as a file system, taking advantage of load balancing and data replication features over multiple machines for storing files.

6. MapReduce can be used for batch processing of data and aggregation operations. The aggregation framework enables users to obtain the kind of results for which the SQL GROUP BY clause is used.

7. JavaScript can be used in queries, aggregation functions (such as MapReduce), and sent directly to the database to be executed.

8. It supports fixed-size collections called capped collections. This type of collection maintains insertion order and, once the specified size has been reached, behaves like a circular queue.

Installing MongoDB on RHEL or CentOS 7

Here are some quick and easy steps to install MongoDB on our CentOS machine. This tutorial also works fine on RHEL 7.

1. Adding Mongo Repository

Now, create a MongoDB Repo file so that you can install MongoDB directly, using yum package manager. This will allow us to download and install the latest version of MongoDB including the latest security fixes, patches and more. You can create the repo file using your favorite Text Editor.

# nano /etc/yum.repos.d/mongodb-org-3.0.repo

Then, add the following lines into that file.

name=MongoDB Repository

2. Installing MongoDB Packages

Now, to install the latest stable version ie 3.0.1, run the following command:

# yum -y install mongodb-org mongodb-org-server

3. Running MongoDB

Now to enable MongoDB to start up automatically in each boot and to start our MongoDB Server, run the following commands.

# chkconfig mongod on
# systemctl start mongod

To check and verify whether Mongo Server is running or not, run the following command to check the status.

# systemctl status mongod

4. Allowing Firewall Port

To allow the firewall to open port 27017 for MongoDB Server, run the below commands.

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

 5. Connect to MongoDB

You should now be able to connect to MongoDB shell using the mongo client.

# mongo


It everything went correctly as described above, you must have your MongoDB running. It is an awesome easy, fast NoSQL Database Server. It stores its data to the JSON-like structure instead of using Tables. We can install MongoDB on almost every Linux machine including Red Hat, Ubuntu, Fedora, Arch Linux and more. If you have any queries, suggestions, comments, please do comment down below. If you have any questions, suggestions, feedback please don’t hesitate to write them in the comment box below because it will help us to improve or correct our contents. Thanks, Happy FOSS Computing. ?

Read More: “How to Install XAMPP Stack on Ubuntu 18.04 LTS”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.