Installing MongoDB on Linux

This section will cover steps for a Centos or RHEL environment as an example.

About this task

To install MongoDB on Linux, do the following:

Procedure

  1. Create a repository file to use YUM to install MongoDB:

    Using root:

    > cd /etc/yum.repos.d

    In /etc/yum.repos.d use VI to create the repository.

    >vi mongodb-org-3.6.repo

    >vi mongodb-org-3.6.repo

    And paste in the following contents:

    [mongodb-org-3.6]

    name=MongoDB Repository

    baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.6/x86_64/

    gpgcheck=1

    enabled=1

    gpgkey=https://www.mongodb.org/static/pgp/server-3.6.asc

    After saving/exiting the file (:wq), execute YUM to install the MongoDB package.

    >yum install mongodb-org

    Note: When copying and pasting, ensure all characters are present (ie: the "-" in the baseurl).
  2. This will install the mongodb components, create the mongod user and default log and data directories. You can validate this by checking that the following two directories exist and are owned by ‘mongod'

    /var/log/mongodb

    /var/lib/mongo

    To modify the default directories, consult the online documentation for MongoDB as referred to earlier.

What to do next

Configuring MongoDB for Sametime