正确卸载mongodb并再次安装mongodb [英] Uninstall mongodb correctly and install mongodb again

查看:106
本文介绍了正确卸载mongodb并再次安装mongodb的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请教我如何在我的virtualbox(ubuntu)中卸载mongodb.

Please teach me how to uninstall my mongodb in my virtualbox(ubuntu).

我尝试了这些命令,但没有删除任何内容:

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

它仍然存在. 我键入mongod --version,它显示db version v2.6.1

It still exists. I type mongod --version it shows db version v2.6.1

更新:

我要删除它,然后重新安装:

I want to remove it and then install it again:

我尝试了以下4个命令-

I tried the following 4 commands -

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

然后 sudo服务mongod start

then sudo service mongod start

并键入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!!

推荐答案

通常,使用apt命令,您可以使用所有mongoDB软件包启动autoremove:

Normally, with apt command, you can launch autoremove with all mongoDB packages :

sudo apt-get autoremove mongodb-*

在mongodb文档上,更改软件包.要获得最新的软件包,请按照说明进行操作:

Ok on the mongodb documentation, the packages are changed. To have an up-to-date package follow instructions :

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10

使用以下命令创建/etc/apt/sources.list.d/mongodb.list列表文件:

Create the /etc/apt/sources.list.d/mongodb.list list file using the following command:

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

并安装所需的软件包:

sudo apt-get install mongodb-org

之后,您将拥有服务器,shell,mongos,...要启动mongodb-server,您可以启动mongodb服务,如下所示:

After that you have server, shell, mongos, ... To launch mongodb-server youcan launch the mongodb service like this :

sudo service mongod start

要连接到本地服务器,只需输入以下命令:

To connect on your local server just enter this command :

mongo

这篇关于正确卸载mongodb并再次安装mongodb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆