Uninstall MongoDB in Ubuntu via command line in 3 easy steps

By | December 27, 2015

Step 1: Stop the service

sudo service mongod stop

Step 2: Remove packages

sudo apt-get purge mongodb-org*

Step 3: Remove data directories

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

-r means recursive

Reference: https://docs.mongodb.org/v3.0/tutorial/install-mongodb-on-ubuntu/

One thought on “Uninstall MongoDB in Ubuntu via command line in 3 easy steps

  1. Luka

    Don’t forget to

    rm -r /data/db

    folder as well (If you don’t intend on keeping the data). Mongo pre-allocates file sizes, meaning even if you have an almost empty database, the files still occupy a substantial amount of storage.

    Reply

Leave a Reply

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