Install MongoDB 3.2 on CentOS/RHEL 5/6/7

MongoDB is an open source no-schema and high-performance document-oriented NoSQL database. NoSQL means it doesn’t provide any tables, rows, etc. MongoDB provides large media storage with GridFS. Click here for more details about mongoDB. NoSQL refers to a database with a data model other than the tabular format used in relational databases such as MySQL, PostgreSQL, and Microsoft SQL. MongoDB features include: full index support, replication, high availability, and auto-sharding.
Install MongoDB

See Also:

  • How to Install MongoDB on Ubuntu
  • Few useful command for MongoDB
  • MongoDB PHP Module (Extension) on CentOS 5/6/7
  • These instructions are help you for installing MongoDB on a CentOS.

    Step #1 Add MongoDB Repository:

    Add following content in yum repository configuration file /etc/yum.repos.d/mongodb.repo.

    # vim /etc/yum.repos.d/mongodb.repo
    

    For 64bit Systems:

    [MongoDB]
    name=MongoDB Repository
    baseurl=http://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/
    gpgcheck=0
    enabled=1
    

    Step #2 Install MongoDB Server:

    Once the repository installed, run the following command to install MongoDB.

    # yum install mongodb-org
    

    Step #3 Start MongoDB:

    After installating MongoDB package on server, Use following command to start service.

    # /etc/init.d/mongod restart
    

    Configure MongoDB to auto start on system boot.

    # chkconfig mongod on
    

    Step #4 Check MongoDB Version:

    Use following command to check installed mongodb version

    # mongod --version
    Or
    # mongo --version
    
    MongoDB shell version: 3.2.0
    

    Step #5 Connect MongoDB:

    Connect MongoDB using command line and test MongoDB working properly or not.

    # mongo
    
    MongoDB shell version: 3.2.0
    connecting to: test
    > use mydb
    switched to db mydb
    > db.test.save( { a: 1 } )
    WriteResult({ "nInserted" : 1 })
    > db.test.find()
    { "_id" : ObjectId("56dec6454b1b26f4c2ff1c28"), "a" : 1 }
    >
    

    References:
    http://docs.mongodb.org/manual/installation/

    Enjoy it!

    No Responses

    Leave a Reply

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

    This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

    The reCAPTCHA verification period has expired. Please reload the page.