Last updated on March 1st, 2016 at 04:11 am
[code lang=”shell”]
vim /etc/yum.repos.d/mongodb.repo
[/code]
Paste this to the file and save using :wq
[code lang=”shell”]
[MongoDB]
name=MongoDB Repository
baseurl=http://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/
gpgcheck=0
enabled=1
[/code]
Download and install mongodb using yum
[code lang=”shell”]
yum install mongodb-org -y
[/code]
Start mongod and configure auto start while system boot
[code lang=”shell”]
/etc/init.d/mongod restart
chkconfig mongod on
[/code]
Check all the versions
[code lang=”shell”]
[root@juzhax ~]# mongo –version
MongoDB shell version: 3.2.3
[root@juzhax ~]# 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
[/code]
Test the connection
[code lang=”shell”]
[root@juzhax ~]# mongo
MongoDB shell version: 3.2.3
> use test
switched to db test
> db.test.save( { juzhax: 1 } )
WriteResult({ "nInserted" : 1 })
> db.test.find()
{ "_id" : ObjectId("56d4ac48b376b143e4749229"), "juzhax" : 1 }
[/code]