Last updated on March 3rd, 2022 at 05:14 pm
Installing MongoDB & Check what version of MongoDB is installed on your system.
This is a 7 year old tutorial and 2.6 version is end of life https://www.mongodb.com/blog/post/mongodb-2-6-end-of-life
That being said you can follow this documentation to install https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/
I am going to leave the tutorial below as is just for any reference. This is outdated and follow mongodb official documentation. I don’t want to just copy paste the content from their website.
We have to also find out whether your OS is 32-bit or 64-bit linux system. Issue the following command.
#uname -m x86_64
I am using 64-BIT Operating System for this demo. Make sure you are logged in as root 🙂
Create a /etc/yum.repos.d/mongodb.repo file to hold the following configuration for MongoDB
Use VI editor and add any of the below configuration details according to your machine type.
If you are running a 64-bit system, use the following configuration:
[mongodb] name=MongoDB Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/ gpgcheck=0 enabled=1
If you are running a 32-bit system, use the following configuration:
[mongodb] name=MongoDB Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686/ gpgcheck=0 enabled=1
To install the latest stable version of MongoDB, issue the following command:
yum install mongodb-org
To install a specific release of MongoDB, append the version number to the package name, as in the following example that installs the 2.7.8 release of MongoDB:
yum install mongodb-org-2.6.8
Once you start MongoDB, Issue this command to find the version.
> db.version()
2.6.8
>
You can find lot of other tutorials in the internet for installing MongoDB on Linux / Unix systems but I have never seen any which explains both 32-bit and 64-bit installation methods. If you find this tutorial helpful please LIKE us on Facebook 🙂