Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Databases»MongoDB»How to Install MongoDB 4.2 on Debian 10/9/8

    How to Install MongoDB 4.2 on Debian 10/9/8

    By RahulFebruary 4, 20212 Mins Read

    MongoDB is a full flexible index support and rich queries database. It is a NoSQL database. MongoDB provides large media storage with GridFS. Click here for more details about this version of MongoDB. Use this tutorial to install MongoDB server 4.2 on Debian 10, Debian 9 Stretch and Debian 8 Jessie systems.

    Advertisement

    Prerequisites

    You must have shell access with sudo privileded account to your Debian system.

    Login to your system and open a shell.

    Step 1 – Installing MongoDB on Debian

    You need to execute following commands step by step to install MongoDB on Debian Linux systems.

    1. First of all, import MongoDB public GPG key in your system
      sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 656408E390CFB1F5
      
    2. Next, add MongoDB apt repository url to your Debian system.
      echo "deb http://repo.mongodb.org/apt/debian "$(lsb_release -sc)"/mongodb-org/4.2 main" | sudo tee /etc/apt/sources.list.d/mongo.list 
      
    3. Now, install the MongoDB server packages on Debian system.
      sudo apt update 
      sudo apt install mongodb-org 
      
    4. Press ‘y’ for any confirmation asked by the installer.

    Step 2 – Manage MongoDB Service

    MongoDB database server has been installed successfully on your system. Let’s execute the below command to start MongoDB servie.

    sudo systemctl start mongod.service 
    

    Also, run the below command to enable MongoDB to start on system boot.

    sudo systemctl enable mongod.service 
    
    • How to Create and Drop Users in MongoDB

    Step 3 – Test MongoDB Version

    Finally, use the below command to check the installed MongoDB version on your system.

    mongod --version 
    
    db version v4.2.1
    git version: edf6d45851c0b9ee15548f0f847df141764a317e
    OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019
    allocator: tcmalloc
    modules: none
    build environment:
        distmod: debian92
        distarch: x86_64
        target_arch: x86_64
    

    Also, connect MongoDB using the command line and execute some test commands for checking proper working.

    [email protected]:~$ mongo
    
    > use mydb;
    
    > db.test.save( { tecadmin: 100 } )
    
    > db.test.find()
    
      { "_id" : ObjectId("52b0dc8285f8a8071cbb5daf"), "tecadmin" : 100 }
    
    • How to Create and Drop database in MongoDB

    database debian mongo mongodb nosql
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    PowerShell Script to Backup SQL Server Databases

    Create and Manage Users in MongoDB: A Comprehensive Guide

    10 MySQL Performance Tuning Tips for Faster Database Queries

    View 9 Comments

    9 Comments

    1. Abdus on July 28, 2019 6:14 am

      Please don not mislead people! If you go the the MongoDB repo(http://repo.mongodb.org/apt/debian) and click on ‘dists’, you won’t see the ‘buster’ version of it yet. Now from where on earth would Debian Debian be downloading the ‘buster’ release?
      Additionally, libcurl3 is replaced by libcurl4. So, ‘stretch’ version of MongoDB won’t work either.

      Please do not put such titles.

      (date: 28/07/2019)

      Reply
      • Rahul on July 29, 2019 7:33 am

        Hi Abdus, I have updated title properly. Will update again once the packages available for Debian Buster.

        Reply
    2. reader on June 17, 2019 6:17 pm

      Doesn’t work on Debian 10, there is no release for buster as of yet. The title of this article is a lie…

      Reply
      • Raúl on June 27, 2019 5:18 pm

        No, there is not, the problem it’s the library libcurl3, that it’s depreciated in debian 10, and still be on use on the package mongo-server, i think it’s a good idea to make a fork of the code and try to solve it 😛

        Reply
        • Secerr on July 12, 2019 2:47 pm

          No, the probleem is not libcurl3. The problem is if you try to install it, it refers to unavailable mongodb-org-server package. So “Reader” is right, this article is not usable for Debian 10.

          Reply
      • pekrij on February 3, 2021 2:51 pm

        It works for me, I have installed mongodb-org 4.2.12 amd64 on Buster

        Reply
    3. Kumar on October 31, 2018 11:56 am

      Thanks for the great article! I have been trying to get MongoDB 4.0 up and running on Raspberry Pi 3 B+ which has ARM64 architecture but have not been able to even after spending countless hours. Would you Be able to help me do it?

      Reply
    4. Tony on November 29, 2017 9:44 pm

      Don’t work with Debian 9!

      Err http://repo.mongodb.org/apt/debian stretch/mongodb-org/3.4 Release
      404 Not Found

      Reply
      • Usama Ejaz on March 6, 2018 9:10 am

        The documentation on https://docs.mongodb.com/manual/tutorial/install-mongodb-on-debian/ states the following:
        > Currently packages are only available for Debian 7 “Wheezy” and Debian 8 “Jessie”.

        Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • A Comprehensive Look at the Simple Mail Transfer Protocol (SMTP)
    • Understanding Basic Git Workflow: Add, Commit, Push
    • The Difference Between Git Reset –soft, –mixed, and –hard
    • Understanding the Staging Area in Git’s Workflow
    • Python Function with Parameters, Return and Data Types
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.