mongodb 正确卸载mongodb并重新安装mongodb
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25624247/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Uninstall mongodb correctly and install mongodb again
提问by user2492364
Please teach me how to uninstall my mongodb in my virtualbox(ubuntu).
请教我如何在我的虚拟机(ubuntu)中卸载我的 mongodb。
I tried these command and nothing was removed :
我尝试了这些命令,但没有删除任何内容:
sudo apt-get purge mongodb mongodb-clients mongodb-server mongodb-dev
sudo apt-get purge mongodb-10gen
sudo apt-get autoremove
It still exists.
I type mongod --version
it shows db version v2.6.1
它仍然存在。我输入mongod --version
它显示 db version v2.6.1
Update:
更新:
I want to remove it and then install it again:
我想删除它然后重新安装它:
I tried the following 4 commands -
我尝试了以下 4 个命令 -
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update
sudo apt-get install mongodb-org
then sudo service mongod start
然后 sudo service mongod start
and type mongo
there is error:
并键入mongo
有错误:
MongoDB shell version: 2.6.4
connecting to: test
2014-09-02T21:27:10.390+0800 warning: Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2014-09-02T21:27:10.392+0800 Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at src/mongo/shell/mongo.js:146
exception: connect failed
Did I miss something? Please help me. Thank you!!
我错过了什么?请帮我。谢谢!!
回答by throrin19
Normally, with apt command, you can launch autoremove with all mongoDB packages :
通常,使用 apt 命令,您可以使用所有 mongoDB 包启动 autoremove :
sudo apt-get autoremove mongodb-*
Ok on the mongodb documentation, the packages are changed. To have an up-to-date package follow instructions :
好的,在 mongodb 文档中,包已更改。要获得最新的软件包,请按照说明进行操作:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
Create the /etc/apt/sources.list.d/mongodb.list
list file using the following command:
/etc/apt/sources.list.d/mongodb.list
使用以下命令创建列表文件:
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
Issue the following command to reload the local package database:
发出以下命令以重新加载本地包数据库:
sudo apt-get update
And install desired packages :
并安装所需的软件包:
sudo apt-get install mongodb-org
After that you have server, shell, mongos, ... To launch mongodb-server youcan launch the mongodb service like this :
之后你有服务器,shell,mongos,......要启动 mongodb-server,你可以像这样启动 mongodb 服务:
sudo service mongod start
To connect on your local server just enter this command :
要连接到本地服务器,只需输入以下命令:
mongo