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.
“how to check if mongodb is installed” Code Answer'sOpen the command prompt and type "cd c:\program files\mongodb\server\your version\bin". After you enter the bin folder type "mongo start". If you get either a successful connection or failed one it means it's installed at least.
Run the Mongo daemon, in one terminal window run ~/mongodb/bin/mongod . This will start the Mongo server. Run the Mongo shell, with the Mongo daemon running in one terminal, type ~/mongodb/bin/mongo in another terminal window. This will run the Mongo shell which is an application to access data in MongoDB.
Now, we have to remove MongoDB packages. We will use apt command to purge MongoDB packages. Running the following command removes all the installed packages for MongoDB. sudo apt-get purge mongodb-org*
The previous release to 3.0 (2.6) should work fine with robomongo sudo service mongod stop sudo apt-get purge mongodb-org* sudo rm -r /var/log/mongodb sudo rm -r /var/lib/mongodb make sure to remove mongodb-server if you're into replica sets.
I suggest that first of all, you completely uninstall Mongo and clean up your system. If you have existing data that you want to keep, you could take a backup of it. By default, it is stored in /var/lib/mongodb. So if you want to take a backup, take a copy of the files from there and keep them in a safe place.
Any databases created in MongoDB, by default, is written to the location /var/lib/mongodb/. Remove /var/lib/mongodb/ and its sub-directories recursively.
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
In my case mongodb
packages are named mongodb-org
and mongodb-org-*
So when I type sudo apt purge mongo
then tab
(for auto-completion) I can see all installed packages that start with mongo
.
Another option is to run the following command (which will list all packages that contain mongo
in their names or their descriptions):
dpkg -l | grep mongo
In summary, I would do (to purge all packages that start with mongo
):
sudo apt purge mongo*
and then (to make sure that no mongo packages are left):
dpkg -l | grep mongo
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*"
and sudo find /var/ -name "*mongo*"
may also show some files that you may want to remove, like:
/etc/systemd/system/mongodb.service
/etc/apt/sources.list.d/mongodb-org-3.2.list
and:
/var/lib/apt/lists/repo.mongodb.*
You may also want to remove user and group mongodb
, to do so you need to run:
sudo userdel -r mongodb
sudo groupdel mongodb
To check whether mongodb
user/group exists or not, try:
cut -d: -f1 /etc/passwd | grep mongo
cut -d: -f1 /etc/group | grep mongo
I suggest the following to make sure everything is uninstalled:
sudo apt-get purge mongodb mongodb-clients mongodb-server mongodb-dev
sudo apt-get purge mongodb-10gen
sudo apt-get autoremove
This should also remove your config from
/etc/mongodb.conf.
If you want to clean up completely and you might also want to remove the data directory
/var/lib/mongodb
use command with sudo,
sudo apt-get autoremove --purge mongodb
OR
sudo apt-get remove mongodb* --purge
It will remove complete mongodb
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With