In this tutorial, How to install MongoDB on Centos. The Local Remi Repository only supports the old MongoDB packages by default. Need to upgrade to higher version need to point to the server of MongoDB. Linux the essential for DevOps Roles.
My environment
- Centos 7/6, Redhat.
- MongoDB Version 4.0
Install Mongodb on Centos/Redhat
Step 1. Disable the current Repository on Centos.
Failure to do this will result in conflicting package MongoDB on Epel Repository. Installing a package management software package:
$ sudo yum install yum-utils
Disable Repository ‘remi- *’ and internet MongoDB package if Pre-ordered:
$ sudo yum-config-manager --disable \*epel\* $ sudo yum-config-manager --disable \*mongo\*
Step 2. Enable Repository MongoDB.
Creating a “/etc/yum.repos.d/mongodb.repo” file with the content as below
[mongodb-org-4.0] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.0/x86_64/ gpgcheck=1 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc
Now, You can install MongoDB directly using yum
$ sudo yum install mongodb-org
The screen output terminal:
Step 3. To disable MongoDB and Enable back the repository epel.
$ sudo yum-config-manager --enable \*epel\* $ sudo yum-config-manager --disable \*mongo\*
To check the MongoDB version
$ mongod --version
The screen output terminal:
Reference to Mongodb
Conclusion
Thought the article, You can “Install MongoDB” as above. I hope will this your helpful.