MongoDB Installation in Ubuntu 22.04 – Step-by-step

May 14, 2022 | By the+gnu+linux+evangelist.

Installing

  1. 3. Making Directory

    Then to Make Needed Directory
    Run:

    sudo mkdir -p /data/db

    If Got “User is Not in Sudoers file” then see: How to Enable sudo
    Then Set the Right Permissions:

    sudo chmod g+w /data/db

    The User Running the MongoDB Server need Write Permission on /data/db!

  2. 4. Installing MongoDB

    Then to Install MongoDB Database on Ubuntu
    Simply play:

    sudo apt install mongodb-org

    If During Installation Got “unknown initscript, /etc/init.d/mongodb not found” Look

  3. 5. Managing MongoDB

    Finally, to Manage MongoDB Database
    To Start it:

    sudo service mongod start

    To Enable Start at Boot:

    sudo chkconfig mongod on

    To Stop MongoDB Server:

    sudo service mongod stop

    To Restart MongoDB Server:

    sudo service mongod restart

    Then Test the Mongodb Shell running:

    mongo
    MongoDB Shell
  4. 6.MongoDB Getting Started

    MongoDB Database Getting-Started Guide

    MongoDB First, Steps Guide

Contents


QuickChic Theme • Powered by WordPress