Install MongoDB Community Edition on Debian/Mint/Ubuntu

Install MongoDB On Linux

Before we start with the install MongoDB process. Let’s first understand the features and benefits of MongoDB.


MongoDb is an open-source application. It will be designed for ease of development.
MonogDb is a NoSql database which means you can not store data in tables like Mysql/Postgres.
MongoDb stores data in JSON format in the document structure.
MongoDb available in only 64-bit for Debian/mint/ubuntu.
MongoDb runs on default port “27017“.
MongoDb main configuration file is “mongod.conf” which is resides under “/etc” directory.

Key Features:

  1. High Performance
     – Index support faster queries
     – use keys from Arrays
     – Reduce Input/Output activity on database
  2. Rich Query Language
    – Support faster read & write operations
  3. High Availability
    – Replication feature provides automatic failover & data redundancy
  4. Horizontal Scalability
    – Supports sharding of data over cluster system’s
  5. Support for Multiple Storage Engines
    – WiredTiger Storage Engine
    – MMAPv1 Storage Engine.

As you see the features and benefits of MongoDb. Now let’s start with the installation procedure. In this tutorial, I have tested this installation process on Debian System. You can follow same steps on Mint/Ubuntu as well.

Install MongoDB

1. Add Package Key

To install MongoDB first you need to add package for the mongodb package. Use below command to add key on the system. To run this command you should have root privileges or sudo access on the system.

$ sudo apt-key adv --keyserver hkp:// --recv EA312927

2. Add MongoDb Repository.

Once the package key added on system. Now you need to create mongodb-3.2.list file under the “/etc/apt/sources.list.d” directory. This file helps to add mongodb repository on apt-get. Use below command to add and create mongodb-3.2.list file,

$ echo "deb wheezy/mongodb-org/3.2 main" | sudo tee /etc/apt/sources.list.d/mongodb-3.2.list

Above command will add Package repository with Mongo version 3.2. If you want to install MongoDb of lower version then just replace the “3.2” with required and available lower version. You will find the list of Mongo version from below link,

3. Reload Local Package Repository

Now run “apt-get update” command which helps to refresh or reload the local package repository and add mongo repository in the list.

$ apt-get update

4. Install MongoDb Package

Now install MongoDB package with help of apt-get install command.

$ sudo apt-get install mongodb-org

If you want to install specific release, You need to specify each package component individually along with the version no.

$ sudo apt-get install -y mongodb-org=3.2.10 mongodb-org-server=3.2.10 mongodb-org-shell=3.2.10 mongodb-org-mongos=3.2.10 mongodb-org-tools=3.2.10

If you install MongoDB version 3.2.10 without including component package then latest version of the component package will be installed with mongoDb.

5. Start|Stop|Restart MongoDb

After the complete installation process, use below command’s to handle the MongoDb service with Start|Stop|Restart.

$ sudo service mongod start
$ sudo service mongod stop
$ sudo service mongod restart

6. Test MongoDb

Now run the below command to test MongoDB is working perfectly.

$ mongo

These are the simple steps you need to follow to install mongoDb. If you feel any difficulties to install MongoDB then please comment down below in comment box. I will definitely try to solve your all doubts regarding mongoDb installation. Stay connected and subscribe to to get the information about new articles on techthings.

Thank You 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *