MongoDB is a leading NoSQL database commonly used in modern web applications. This tutorial will walk you through setting up MongoDB on Red Hat Enterprise Linux (RHEL) and CentOS Linux:
Update your system before beginning installation.
Install MongoDB with the yum package manager.
# nano /etc/yum.repos.d/mongodb-org-4.4.repo
# sudo yum install -y mongodb-org
If you need to install a specific version or prevent automatic upgrades, see the MongoDB documentation.
# systemctl start mongod.service
# systemctl enable mongod.service
MongoDB is not secure by default.
Note: Any start-up warnings related to Readahead can be safely ignored. To prevent these warnings, verify that the sectors are “as stated” in the warning by running blockdev –getra /dev/vda1. If the output is greater than 512, run the following commands:
blockdev –getra /dev/vda1
blockdev --setra 512 /dev/vda1
systemctl restart mongod
The warning will now be resolved.
Powered by BetterDocs