Installing MongoDB Using RPM Package
Step 1: Download RPM package from MongoDB website.
We will need to download these 6 mongoDB package from official mongoDB RPM repository to get complete featurs of mongodb. We will use wget command for that.
Package 1: mongodb-org
wget https://repo.mongodb.org/yum/redhat/9/mongodb-org/7.0/x86_64/RPMS/mongodb-org-7.0.6-1.el9.x86_64.rpm
Package 2: mongodb-mongosh
wget https://repo.mongodb.org/yum/redhat/9Server/mongodb-org/7.0/x86_64/RPMS/mongodb-mongosh-2.1.5.x86_64.rpm
Package 3: mongodb-org-mongos
wget https://repo.mongodb.org/yum/redhat/9Server/mongodb-org/7.0/x86_64/RPMS/mongodb-org-mongos-7.0.6-1.el9.x86_64.rpm
Package 4: mongodb-org-tools
wget https://repo.mongodb.org/yum/redhat/9Server/mongodb-org/7.0/x86_64/RPMS/mongodb-org-tools-7.0.6-1.el9.x86_64.rpm
Package 5: mongodb-org-database
wget https://repo.mongodb.org/yum/redhat/9Server/mongodb-org/7.0/x86_64/RPMS/mongodb-org-database-7.0.6-1.el9.x86_64.rpm
Package 6: mongodb-org-server
wget https://repo.mongodb.org/yum/redhat/9Server/mongodb-org/7.0/x86_64/RPMS/mongodb-org-server-7.0.5-1.el9.x86_64.rpm
Step 2: Install MongoDB
Installing dependencies:
cyrus-sasl and openssl are the dependencies that are required by some packages, we will install those dependencies first before installing .rpm packages using yum package manager.
sudo yum install cyrus-sasl openssl -y
We will use rpm -i command to install the downloaded rpm package.
Syntax: sudo rpm -i <package-name>
sudo rpm -i mongodb-*
Installation is completed. Now you can move on to starting services section.
How to Install MongoDB on CentOS?
MongoDB is a flexible, powerful, and super-fast database management system. Unlike those old-school databases with strict rules, MongoDB lets you store your data in flexible documents, similar to how you organize things in JSON. This means you can easily add new information or change things up without much hassle.
In this article, we will install MongoDB on CentOS using two methods.
Table of Content
- How to Install MongoDB on CentOS?
- Method 1: Installing MongoDB Using RPM Package
- Method 2: Installing MongoDB Using Official Repository
- Starting MongoDB Services After Installation
- Running MongoDB with MongoDB Shell
- How to Verify MongoDB Installation on CentOS?
- How to Uninstall MongoDB?