Posts MongoDB-3.6 Community Edition Installation
Post
Cancel

MongoDB-3.6 Community Edition Installation

In this post, I am going to use yum to install MongoDB-3.6 from MongoDB’s official repository. First we start with adding a .repo file at location /etc/yum.repos.d/. You can name the file anyway you wish but the extension has to be .repo.

1
vim /etc/yum.repos.d/mongodb.repo

mongodb installation

Paste the follow code into the .repo file you created, save and exit. You can change 3.6 to the version you want. For instance, 3.4 or 3.2.

1
2
3
4
5
6
[mongodb-org-3.6]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.6/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.6.asc

mongodb installation

Check if the repository is successfully added.

1
yum repolist

mongodb installation

Start installing MongoDB.

1
yum install mongodb-org

mongodb installation

The functionality of each installed packages.
mongodb installation

After installation, let’s check the initial status of mongod.

1
systemctl status mongod

mongodb installation

For more usage of systemctl, please refer: CentOS7 Systemctl Cheat Sheet

Mongod is enabled initially. If the service is not enabled, use command below to enable and start the service.

1
2
systemctl enable mongod
systemctl start mongod

mongodb installation

Check the version of mongod.

1
mongo -version

mongodb installation

Locations related to Mongodb.

  1. /etc/mongod.conf; config file of mongod.
  2. /var/log/mongodb/; log file of mongod.
  3. /var/lib/mongo/; db path of mongod, all data files are store here.

mongodb installation

Connect to mongod.

1
mongo

mongodb installation

REPLATED POSTS:
MongoDB Enable User Login Authentication
Setup MongoDB Replication With Arbiter Environment

REFERENCES:
Install MongoDB Community Edition on Red Hat Enterprise or CentOS Linux

This post is licensed under CC BY 4.0 by the author.