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
- start with removing all PPA repositories for mongodb, then:
- sudo apt-get purge mongodb-org*
- sudo apt remove mongodb
- sudo apt purge mongodb
- sudo apt autoremove
- sudo rm -r /var/log/mongodb
- sudo rm -r /var/lib/mongodb
- sudo apt-get install gnupg
- wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
- 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
- sudo apt-get update
- sudo apt-get upgrade
- sudo apt update
- sudo apt upgrade
- sudo apt-get install -y mongodb-org
- sudo apt-get install libc6
- sudo service mongod start
- sudo service mongod status
This helped me with the issue
Related Topics
Graphics Card Memory and Virtual Address Space of a Process
How to Call Makefile Located in Other Directory
Using Output of Previous Commands in Bash
Checking Shared Libraries for Non Default Loaders
How to Get Maximum Tcp Receive/Send Window in MAC Os X
Angular Cli App Not Running When Deploying to Linux App Service
Docker Compose Volume Permissions Linux
Which Characters Are Allowed in a Bash Alias
Recommended Irc Server (Ircd) for a Small Site
What Do I Need to Debug Pthreads
How to Find Files Except Given Name
Best Way to Build Cross Toolchains on MAC Os X
How to Programmatically Invert Screen Colors in Linux
What Ncurses Frameworks Are Available for Bash
Cx_Oracle: Distutils.Errors.Distutilssetuperror: Cannot Locate Oracle Include Files