How To Install mongodb on Debian 9

In this tutorial we learn how to install mongodb on Debian 9. mongodb is object/document-oriented database (metapackage)

Introduction

In this tutorial we learn how to install mongodb on Debian 9.

What is mongodb

mongodb is:

MongoDB is a high-performance, open source, schema-free document-oriented data store that’s easy to deploy, manage and use. It’s network accessible, written in C++ and offers the following features:

* Collection oriented storage - easy storage of object-style data
* Full index support, including on inner objects
* Query profiling
* Replication and fail-over support
* Efficient storage of binary data including large objects (e.g. videos)
* Auto-sharding for cloud-level scalability

High performance, scalability, and reasonable depth of functionality are the goals for the project.

This is a convenience metapackage that depends on all the mongodb parts: the server, the clients and the development files (headers and library).

There are three methods to install mongodb on Debian 9. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install mongodb Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install mongodb using apt-get by running the following command:

sudo apt-get -y install mongodb

Install mongodb Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install mongodb using apt by running the following command:

sudo apt -y install mongodb

Install mongodb Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Debian. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install mongodb using aptitude by running the following command:

sudo aptitude -y install mongodb

How To Uninstall mongodb on Debian 9

To uninstall only the mongodb package we can use the following command:

sudo apt-get remove mongodb

Uninstall mongodb And Its Dependencies

To uninstall mongodb and its dependencies that are no longer needed by Debian 9, we can use the command below:

sudo apt-get -y autoremove mongodb

Remove mongodb Configurations and Data

To remove mongodb configuration and data from Debian 9 we can use the following command:

sudo apt-get -y purge mongodb

Remove mongodb configuration, data, and all of its dependencies

We can use the following command to remove mongodb configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge mongodb

Dependencies

mongodb have the following dependencies:

References

Summary

In this tutorial we learn how to install mongodb package on Debian 9 using different package management tools: apt, apt-get and aptitude.