Installing MongoDB on Linux

This section will cover steps for a Centos or RHEL environment as an example. For more information on installing MongoDB on other Operating Systems, refer to the MongoDB documentation here (Install MongoDB).

About this task

To install MongoDB 4.2 on Linux, do the following:

Note:
  • MongoDB 3.6.x version is supported on HCL Sametime 11.5. MongoDB 4.2.x is the recommended version for HCL Sametime 11.5. Upgrading MongoDB 3.6.x to 4.2.x instructions can be found here.
  • All commands provided require running as ROOT or SUDO access. If not running as root user, preface all commands with ‘sudo'.

Procedure

  1. Create a repository file for YUM to install MongoDB. Use VI to create and edit the file mongodb-org-4.2.repo
    
    > cd /etc/yum.repos.d 
    > vi mongodb-org-4.2.repo
    Note: “vi” is a screen-oriented text editor originally created for the Unix operating system.
  2. To edit the file, use Insert (I) and copy/paste the following contents:
    
    [mongodb-org-4.2] 
    name=MongoDB Repository 
    baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.2/x86_64/ 
    gpgcheck=1 
    enabled=1 
    gpgkey=https://www.mongodb.org/static/pgp/server-4.2.asc 
     
    Note: When copying and pasting, ensure all characters are present. The "-" in the baseurl can be removed in certain scenarios.

    Prese “Esc” to exit INSERT mode and save/exit with the command wq. Open a command with “:” and use “wq” to save and exit.



    Note: If the error “E212: Can’t open file for writing” is received, root user or sudo access is not being used.


  3. Execute YUM to install the MongoDB package.
    >yum install mongodb-org 

    Enter “y” to confirm the download and installed size.



    Enter “y” to accept the GPG key import.



    The MongoDB install will report “Complete!”



    Note:

    For more information on MongoDB documentation, click Install MongoDB.

  4. The results of the install will create the mongodb components, user, default log and data directories. You can validate this by checking if the following two directories exist and are owned by ‘mongod'.
    /var/log/mongodb


    /var/lib/mongo


  5. To start the MongoDB server, enter the command:
    > service mongod start

    To stop the MongoDB server, enter the command:

    > service mongod stop

    To verify the status of the MongoDB service, enter the command:

    > systemctl status mongod


What to do next

Configuring MongoDB for Sametime