Install MongoDB 3.2 on CentOS.
MongoDB (named from "huMONGOus") is a database with comprehensive and flexible indexing support and rich queries. MongoDB provides powerful media storage through GridFS. Click here for more information about MongoDB.
MongoDB released a new stable version 3.2, which has been greatly improved. This tutorial will help you install MongoDB 3.2.X on CentOS, RHEL, and Fedora systems.
Step 1: Add MongoDB to the yum Repository
Add the following content to the configuration file/etc/yum. repos. d/MongoDB. repo of the yum repository according to the mongodb version and system architecture you need. In this article, we use the MongoDB 3.2 repository.
64-bit system usage:
[MongoDB]name=MongoDB Repositorybaseurl=http://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/gpgcheck=0enabled=1
Step 2-install the MongoDB Server
Use the yum Package Manager to install the mongodb-org package. This operation will automatically install all dependencies. To install a specific MongoDB revision, specify the package name with the version number, such as the mongodb-org-3.2.0. The following command installs the latest available stable version.
# yum install mongodb-org
Step 3-start MongoDB
The mongodb-org-server package provides the MongoDB initialization script and uses scripts to start the service.
# /etc/init.d/mongod restart
Configure MongoDB to start with the System
# chkconfig mongod on
Step 4 -- check the MongoDB version
Run the following command to check the MongoDB version:
[root@tecadmin ~]# mongod --versiondb version v3.2.0git version: 45d947729a0315accb6d4f15a6b06be6d9c19fe7OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013allocator: tcmallocmodules: nonebuild environment: distmod: rhel70 distarch: x86_64 target_arch: x86_64
Connect to MongoDB and execute several test commands to check whether it works properly
[root@tecadmin ~]# mongo> use mydb;> db.test.save( { a: 1 } )> db.test.find() { "_id" : ObjectId("54fc2a4c71b56443ced99ba2"), "a" : 1 }
Congratulations, you have successfully installed the MongoDB server on your system. You can also practice MongoDB browser shell here.
Refer:
Http://docs.mongodb.org/manual/installation/
Original article address
How to Install MongoDB 3.2 on CentOS/RHEL & Fedora