Reinstall MongoDb Fails

Mindwatering Incorporated

Author: Tripp W Black

Created: 12/27/2019 at 06:33 PM

 

Category:
Ubuntu
General

Issue:
If you uninstall mongodb-org, you cannot reinstall a different version. (e.g. go from 4.2 back to 3.6.12)
$ sudo apt-get purge mongodb-org
$ sudo apt autoremove
The reinstall appears successful, but the service fails to start.

Doing a reinstall also doesn't work:
$ sudo apt-get install mongodb-org --reinstall

Solution:
You have to also remove the config files. Purge doesn't seem to do them all.
$ sudo apt-get purge mongodb-org
$ sudo apt-get purge mongodb-org*
$ sudo apt autoremove
$ rm /etc/mongod.conf
$ rm -r /var/lib/mongodb/
$ rm -r /var/log/mongodb/
Reinstall old version:
$ apt-get install mongodb-org=3.6.12



previous page

×