I am having trouble uninstalling mongo from a 64 bit EC2. In /usr/bin I have mongo and mongod amongst others. When I type mongo from anywhere it opens the shell at version 1.8. I now downloaded 2.0.2 and in that folder when I run mongo it opens up version 2.0.2
My question is how do I purge mongo fully so I can install 2.0.2 without coming across the old 1.8 version?
EDIT: I believe I used yum (it was a while ago), and I think the ec2 is fedora.
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.
To delete all documents in a collection, pass an empty document ( {} ). Optional. To limit the deletion to just one document, set to true . Omit to use the default value of false and delete all documents matching the deletion criteria.
Open 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.
1.Stop Mongo DB using -
sudo service mongod stop
2.Remove Packages using -
sudo yum erase $(rpm -qa | grep mongodb-org)
3.Remove Data Directories using -
sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongo
yum erase mongo-10gen mongo-10gen-server
I needed to run a yum list installed | grep mongo
then yum remove those packaged
This should work
rpm -qa | less | grep mongo
using that command will give you the mongo packages you have installed, after that you can do
rpm -qa | less | grep mongo | xargs yum remove // <-- this will remove all packages automatically
but can also remove all of them Manually
this gets the job done easily
sudo yum erase mongodb-org*
First stop the mongo service
sudo service mongod stop
Then remove the packages
sudo yum erase $(rpm -qa | grep mongodb-org)
Then remove the log(data) directories
sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongo
For Ubuntu users:
First, stop the service of MongoDB and then try uninstalling mongod.
Then, type these commands to uninstall mongodb:
sudo apt-get purge mongodb mongodb-clients mongodb-server mongodb-dev
sudo apt-get purge mongodb-10gen
sudo apt-get autoremove
I used dnf
command to list and uninstall mongodb from my EC2 servers (RedHat Enterprise Linux 8). Hope this helps for the RHEL8 users.
DNF
_ is the next upcoming major version ofYUM
_, a package manager for RPM-based Linux distributions. It roughly maintains CLI compatibility with YUM and defines a strict API for extensions and plugins.
For further reading about DNF usage...
https://dnf.readthedocs.io/en/latest/command_ref.html
To list down the mongodb installations (Use sudo if required)
sudo dnf list installed|grep mongodb
To uninstall/remove mongodb
sudo dnf remove mongodb-org
Then run the list command again to see if the installation is successful. It shouldn't show any mongodb-org packages if the uninstallation was successful.
sudo dnf list installed|grep 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