MongoDB Tutorials

How to Completely Uninstall MongoDB from Linux?

Today we are going to look at how to completely uninstall MongoDB from Linux, in order to clean up mongoDB from your system you should remove mongoDB configuration files, data, and logs.

This tutorial will help you to remove mongoDB application from your system But remember, before removing mongoDB from your device you must take the backup of your mongoDB data because this process is irreversible.

Uninstalling MongoDB

You can follow given below step by step methods to uninstall MongoDB.

Stop MongoDB Daemon Process

First, you must stop the `mongod` process in your system to completely uninstall the mongoDB:

Open the terminal and run the command:

sudo service mongod stop

Use APT to Remove MongoDB Packages

Using the given below command will completely remove the MongoDB packages from your system.

sudo apt-get purge mongodb-org*

How to Remove MongoDB Logs?

In this step, we are going to tell you how to remove the mongoDB logs. We must know the mongoDB log location before removing them. MongoDB logs are kept inside /var/log/mongodb/.

sudo rm -r /var/log/mongodb

Given above command will remove the logs and its associated sub-directories.

Uninstalling MongoDB from Ubuntu

In this final step, we will remove the MongoDB from ubuntu from the following location /var/lib/mongodb/. However, if you have set MongoDB in any other location then you can pass your MongoDB location along with the remove command:

sudo rm -r /var/lib/mongodb


In this MongoDB tutorial, we have learn to remove MongoDB from ubuntu. I hope this tutorial must have helped you. If this tutorial really helped you to delete MongoDB then you should share it with others as well.

To know more about MongoDB you can visit MongoDB website.


I am Digamber, a full-stack developer and fitness aficionado. I created this site to bestow my coding experience with newbie programmers. I love to write on JavaScript, ECMAScript, React, Angular, Vue, Laravel.

Recent Posts

React Redux Handle API Calls with Thunk Middleware Tutorial

In this post, we will learn how to work with HTTP requests in the Redux…

1 day ago

Node AJAX Retrieve Records from MySQL Database Tutorial

MySQL is a relational database management system based on SQL – Structured Query Language, and…

4 days ago

React Manage REST API State Globally with Context API Tutorial

React Js Handle Rest API data globally with Context and useState hook tutorial. In this…

1 week ago

How to Delete Data from MySQL Database using Node Js

Node js delete data from MySQL database tutorial; Throughout this guide, you will ascertain how…

1 week ago

Node Import CSV File Data to MySQL Database with HTML Form

In this tutorial, you will discover how to import CSV file into MySQL database using…

2 weeks ago

How to Handle Global State in React js using Context API

React Js Global state management with createContext hook example; In this tutorial, we will help…

2 weeks ago