Uninstall mongoDB from ubuntu

Anita picture Anita · Apr 10, 2015 · Viewed 154.2k times · Source

I have installed MongoDB 3.0.1 following the commands in Install MongoDB Community Edition on Ubuntu on my ubuntu 14.04 64 bit system and I installed Robomongo interface to use that.

When I try to connect MongoDB using Robomongo I get an error that authorization failed. I found Add support for SCRAM-SHA-1 authentication (MongoDB 3.0+) which explains that Robomongo 0.8.5 doesn't support MongoDB 3.0.X fully.

In response, I want to remove MongoDB 3.0.1 and install MongoDB 2.2.

I tried the following commands:

 apt-get remove --purge mongodb

and also

apt-get autoremove --purge mongodb

In both cases I got the following error:

" Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied) E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?"

Any help would be appreciated.

Answer

alicanozkara picture alicanozkara · Oct 22, 2016
sudo service mongod stop
sudo apt-get purge mongodb-org*
sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongodb

this worked for me