How to uninstall mongodb 7.0 from ubuntu

Created at 09-Nov-2023 , By samar

To uninstall MongoDB from Ubuntu, you have to first open the terminal, stop the daemon process, and remove the MongoDB applications, configuration files, data files, and log files. 

Follow these step-by-step instructions to ensure a clean and successful removal of MongoDB.

1. First open your terminal.

2. Let's verify whether MongoDB is installed on your system or not. We'll use the below commands to check it.

mongod –version

3. Stop MongoDB process

sudo service mongod stop

4. Remove the installed MongoDB packages completely.

sudo apt-get purge mongodb-org*

5. Remove the data directories, MongoDB database(s), and log files

sudo rm -r /var/log/mongodb /var/lib/mongodb

6. To check if MongoDB is successfully uninstalled or not.

service mongod status

You'll have successfully uninstalled MongoDB from your Ubuntu system.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Buy Me A Coffee

Don't forget to share this article! Help us spread the word by clicking the share button below.

We appreciate your support and are committed to providing you valuable and informative content.

We are thankful for your never ending support.