08.21.2019

How to install mongodb on centos

This article will show how to install mongodb 3.2 on centos

Create a /etc/yum.repos.d/mongodb-org-3.2.repo file so that you can install MongoDB directly, using yum.

vim /etc/yum.repos.d/mongodb-org-3.2.repo

Past all below content into new file
[mongodb-org-3.2]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.2.asc
Next, run the following command:

sudo yum install -y mongodb-org

If you want to install other version or specific release of mongodb, you could run following command:

sudo yum install -y mongodb-org-3.2.10 mongodb-org-server-3.2.10 mongodb-org-shell-3.2.10 mongodb-org-mongos-3.2.10 mongodb-org-tools-3.2.10

Finally, start it:

/etc/init.d/mongod start

Happy coding.

Leave a comment