How to Install MongoDB on CentOS 7

r00t August 7, 2017

Install MongoDB on CentOS 7

In this tutorial we’ll learn how to install MongoDB on CentOS 7. We will also install and configure its prerequisites. MongoDB is an open source, document database based on the cutting edge technology of NoSQL. It supports development of modern web applications, with features such as strong consistency, flexibility, expressive query languages and secondary indexes plus a lot more.

I recommend to use a minimal Ubuntu server setup as a basis for the tutorial, that can be a virtual or a root server image with an CentOS 7 minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.

Install MongoDB on CentOS 7

Step 1. First, ensure your system is fully up-to-date by running the following:

yum -y update

Step 2. Installing MongoDB on Ubuntu system.

First, add the official MongoDB repository:

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

Now add the following lines:

[mongodb]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1

To start installing MongoDB from the repository we just added, we issue the command:

yum update -y
yum install mongodb-org mongodb-org-server

Next, Start the MongoDB service and make it auto-start on system boot:

systemctl enable mongod
systemctl start mongod

Step 4. Connecting MongoDB Terminal.

Once the installation is done, you can connect to MongoDB terminal and execute the commands for the tasks you want to do:

mongo

Congratulation’s! You have successfully configured MongoDB on your CentOS 7 server.

The Tags:

Leave a Comment

Comments are closed.