How To Install mongodb-server on Debian 9

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

Introduction

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

What is mongodb-server

mongodb-server 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 package contains the server itself (mongod) and the sharding server/load-balancer (mongos).

There are three methods to install mongodb-server 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-server 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-server using apt-get by running the following command:

sudo apt-get -y install mongodb-server

Install mongodb-server Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install mongodb-server

Install mongodb-server 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-server using aptitude by running the following command:

sudo aptitude -y install mongodb-server

How To Uninstall mongodb-server on Debian 9

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

sudo apt-get remove mongodb-server

Uninstall mongodb-server And Its Dependencies

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

sudo apt-get -y autoremove mongodb-server

Remove mongodb-server Configurations and Data

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

sudo apt-get -y purge mongodb-server

Remove mongodb-server configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge mongodb-server

Dependencies

mongodb-server have the following dependencies:

References

Summary

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