Can't Remove, Purge, Unistall Mongodb from Debian

Can't remove, purge, unistall mongodb from debian

To avoid that sort of problems you should install software only from native Debian repositories. Unfortunately it is not unusual when sloppy/incompetent 3rd party packages are responsible for such troubles.

To recover try removing file /var/lib/dpkg/info/mongodb-org-server.postinst before attempting to apt-get purge mongodb.

how to completely remove mongoDB with all instance from ubuntu

Try the below steps accordingly:

First stop the mongod process

  • sudo service mongod stop

Remove any MongoDB packages

  • sudo apt-get purge mongodb-org*

Remove MongoDB databases and log files

  • sudo rm -r /var/log/mongodb

  • sudo rm -r /var/lib/mongodb

Remove MongoDB Service

  • sudo rm /etc/systemd/system/mongodb.service

For Ubuntu 20.04 LTS use this path sudo rm /lib/systemd/system/mongod.service

This should work for you.

Unable to install mongodb properly on ubuntu 18.04 LTS

You need to first uninstall the mongodb, you can use:

sudo apt-get purge mongodb-org*

After this, install mongodb through the following commands:

sudo apt-get install mongodb

And then update:

sudo apt-get update

You are done with the installation of mongodb. You can check it by using the below command:

mongo --version

can't install Mongodb properly from terminal ubuntu 18.04 LTS

There exists an existing package hence the below error "trying to overwrite".

dpkg: error processing archive /var/cache/apt/archives/mongodb-org-mongos_4.2.1_amd64.deb (--unpack):
trying to overwrite '/usr/bin/mongos', which is also in package mongodb-server-core 1:3.6.3-0ubuntu1.1

try using --force-overwrite to overwrite the package

Command to Run
sudo dpkg -i --force-all /var/cache/apt/archives/mongodb-org-mongos_4.2.1_amd64.deb

Then run install
sudo apt-get install -f mongodb-org

Delete everything in a MongoDB database

In the mongo shell:

use [database];
db.dropDatabase();

And to remove the users:

db.dropAllUsers();

Upgrading mongodb has no effect and still shows the old version

I'm in the exact same situation, followed the exact same steps, and had the same issue.

What worked for me was:

Uninstalling:

sudo service mongod stop
sudo apt-get purge "mongodb-org*"

Do NOT remove data directories - all your data will be lost if you do.

Don't forget the quotes to prevent shell from interpreting.

Note: Calling sudo apt-get purge "mongodb-org*" deletes the mongod.conf file. In case you want to keep this file after the update, make sure you create a backup copy of it and use it after the new version has been installed.

Then install mongodb with:

sudo apt-get install -y mongodb-org

This assumes that you've already performed the previous installation steps (importing the public key, creating a list file, reloading local package database) as you've stated.

Problems Installing Mongodb on Ubuntu 20.04

  1. start with removing all PPA repositories for mongodb, then:
  2. sudo apt-get purge mongodb-org*
  3. sudo apt remove mongodb
  4. sudo apt purge mongodb
  5. sudo apt autoremove
  6. sudo rm -r /var/log/mongodb
  7. sudo rm -r /var/lib/mongodb
  8. sudo apt-get install gnupg
  9. wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
  10. echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
  11. sudo apt-get update
  12. sudo apt-get upgrade
  13. sudo apt update
  14. sudo apt upgrade
  15. sudo apt-get install -y mongodb-org
  16. sudo apt-get install libc6
  17. sudo service mongod start
  18. sudo service mongod status

This helped me with the issue



Related Topics



Leave a reply



Submit