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.
use command with sudo,
OR
It will remove complete mongodb
In my case
mongodb
packages are namedmongodb-org
andmongodb-org-*
So when I type
sudo apt purge mongo
thentab
(for auto-completion) I can see all installed packages that start withmongo
.Another option is to run the following command (which will list all packages that contain
mongo
in their names or their descriptions):In summary, I would do (to purge all packages that start with
mongo
):and then (to make sure that no mongo packages are left):
Of course, as mentioned by @alicanozkara, you will need to manually remove some directories like
/var/log/mongodb
and/var/lib/mongodb
Running the following
find
commands:sudo find /etc/ -name "*mongo*"
andsudo find /var/ -name "*mongo*"
may also show some files that you may want to remove, like:
and:
You may also want to remove user and group
mongodb
, to do so you need to run:To check whether
mongodb
user/group exists or not, try:this worked for me
To uninstalling existing MongoDB packages. I think this link will helpful.
I suggest the following to make sure everything is uninstalled:
This should also remove your config from
If you want to completely clean up, you might also want to remove the data directory
/var/lib/mongodb
Sometimes this works;