In this guide, we are going to learn how to install MongoDB 4 on Fedora 30/29/CentOS 7. MongoDB is a free-to-use cross-platform document-oriented database program. It is classified as a NoSQL database and thus it stores data in flexible, JSON-like documents, meaning fields can vary from document to document and data structure can be changed over time.
Installing MongoDB 4 on Fedora 30/29/CentOS 7
Add MongoDB Repository
Installation of MongoDB 4 on Fedora 30/29/CentOS 7 requires that you create the MongoDB YUM repository as shown below;
vim /etc/yum.repos.d/mongodb-org-4.0.repo
[mongodb-org-4.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/7/mongodb-org/4.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc
Install MongoDB 4 on Fedora 30/29/CentOS 7
Once you have the MongoDB repo created as shown above, proceed to install mongodb-org package. This package will automatically install the other four MongoDB component packages; mongodb-org-server
, mongodb-org-mongos
, mongodb-org-shell
and mongodb-org-tools
.
Well, you can you use the YUM command to install Mongodb across all the distros, you can be more specific and use each distro’s package manager.
CentOS 7/Fedora 30/29
yum install mongodb-org
Fedora 30/29
dnf install mongodb-org
Start MongoDB Service
Once the installation is done, you can start MongoDB service by running the command below;
systemctl start mongod
To configure MongoDB to run on system boot, run the command below;
systemctl enable mongod
To check the status of MongoDB
systemctl status mongod
● mongod.service - MongoDB Database Server
Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2019-05-25 08:17:35 EAT; 1min 0s ago
Docs: https://docs.mongodb.org/manual
Main PID: 7761 (mongod)
CGroup: /system.slice/mongod.service
└─7761 /usr/bin/mongod -f /etc/mongod.conf
To check the version of MongoDB, run the command below;
mongod --version
db version v4.0.9
git version: fc525e2d9b0e4bceff5c2201457e564362909765
OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
allocator: tcmalloc
modules: none
build environment:
distmod: rhel70
distarch: x86_64
target_arch: x86_64
Well, that is just it on installation of MongoDB 4 on Fedora 30/29/CentOS 7. You can read more on Getting Started Manual.
References:
Installing MongoDB Manual
Check our other articles on the links below;
Install Fedora 30 Workstation on VirtualBox