# ubuntu下mongodb彻底卸载方式

By [Untitled](https://paragraph.com/@0xfd8c0fb8625de79015784a79df38c7d0f0bfa063) · 2021-10-18

---

直接上操作

1.停止 mongodb服务

sudo service mongod stop

2.卸载mongodb

sudo apt-get remove mongodb

3.移除相关包

sudo apt-get purge mongodb-org\*

sudo apt-get purge mongodb

sudo apt-get autoremove

sudo apt-get autorclean

4.移除相关目录

sudo rm -r /var/log/mongodb

sudo rm -r /var/lib/mongodb

5.查看系统还有哪些残留的文件或目录

whereis mongo

whereis mongodb

whereis mongod

which mongo

which mongodb

which mongod

![](https://storage.googleapis.com/papyrus_images/0a38b68f1088af4e85d3129a1ecde283882e3f3ed64b5713e8e42f10cc9ebdcc.png)

---

*Originally published on [Untitled](https://paragraph.com/@0xfd8c0fb8625de79015784a79df38c7d0f0bfa063/ubuntu-mongodb)*
