(ve):Set up MongoDB on CentOS

  • This page was last modified on February 2, 2011, at 10:29.
The (mt) Community Wiki is a collaborative project. Any (mt) Media Temple customer or employee may contribute. Not all articles and/or content have been tested for accuracy by (mt) Media Temple.

For officially moderated and tested articles, be sure to visit our KnowledgeBase.

From (mt) Community Wiki

Contents

Overview

MongoDB (from "humongous") is an open source, scalable, high-performance, schema-free, document-oriented database written in the C++ programming language. The database is document-oriented so it manages collections of JSON-like documents. Many applications can, thus, model data in a more natural way, as data can be nested in complex hierarchies and still be query-able and index-able.

Development of MongoDB began in October 2007 by 10gen. The first public release was in February 2009.

Instructions

  1. Add the 10gen repository: We're going to tell yum to use another repository for our MonogoDB. This is referenced from the MongoDB website. First, create a file called 10gen.repo in
    pico /etc/yum.repos.d/10gen.repo
    

    Add the following:

    [10gen]
    name=10gen Repository
    baseurl=http://downloads.mongodb.org/distros/centos/5.4/os/x86_64/
    gpgcheck=0
    

    Reference: http://www.mongodb.org/display/DOCS/CentOS+and+Fedora+Packages

  2. Update: Update yum, using the following command this may take awhile.
    yum update
    
  3. Search: See what versions of Mongo are available by typing, see Figure 1:
    yum search mongo
    
    Figure 1: Sample output.
  4. Install (STABLE): We're going to install the stable server based on the 64bit architecture, see Figure 2. Run the following:
    yum install mongo-stable-server.x86_64
    
    Figure 2

    If you're curious to know if your server is 64bit or 32bit, type

    uname -a
    

    By default, (ve) Servers are 64bit.

    If you want more insight as to what was installed, type:

    yum info mongo-stable-server.x86_64
    
  5. Start Mongo: Mongo needs to be started in the shell, before it can be used. See Figure 3 and 4. There's a number of ways you can do this. One way is: In another terminal type:
    mongod
    
    Figure 3

    Figure 4

    Close the terminal.

    For advanced procedures regarding stopping and starting MongoDB, please see the MongoDB documentation.
  6. DONE!

Notes/Supplemental