How to Install MongoDB 3.2 on CentOS 7

[code lang=”shell”]
vim /etc/yum.repos.d/mongodb.repo
Paste this to the file and save using :wq
[code lang=”shell”]

name=MongoDB Repository
Download and install mongodb using yum
[code lang=”shell”]
yum install mongodb-org -y
Start mongod and configure auto start while system boot
[code lang=”shell”]
/etc/init.d/mongod restart
chkconfig mongod on
Check all the versions
[code lang=”shell”]
[[email protected] ~]# mongo –version
MongoDB shell version: 3.2.3
[[email protected] ~]# mongod –version
db version v3.2.3
git version: b326ba837cf6f49d65c2f85e1b70f6f31ece7937
OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
allocator: tcmalloc
modules: none
build environment:
distmod: rhel70
distarch: x86_64
target_arch: x86_64
Test the connection
[code lang=”shell”]
[[email protected] ~]# mongo
MongoDB shell version: 3.2.3
> use test
switched to db test
> { juzhax: 1 } )
WriteResult({ "nInserted" : 1 })
> db.test.find()
{ "_id" : ObjectId("56d4ac48b376b143e4749229"), "juzhax" : 1 }


Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.