Ubuntu 18.04.3 - 尝试卸载 mongodb 时提示不存在,尝试安装时提示存在

Ubuntu 18.04.3 - 尝试卸载 mongodb 时提示不存在,尝试安装时提示存在

我一直在研究这个问题,也读了很多文章。我正试图让它在由 digital ocean 托管的测试服务器上运行。出于某种原因,我的服务器似乎不知从何而来地无法连接到 Mongodb,所以因为这是一个测试,在耗尽这些资源后,我决定删除并重新安装,但是,每当尝试删除 mongodb 时,它都说它不存在:运行后$ sudo apt-get purge mongodb mongodb-server mongodb-server-core mongodb-clients

Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'mongodb' is not installed, so not removed
Package 'mongodb-clients' is not installed, so not removed
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 mongodb-org : Depends: mongodb-org-server but it is not going to be installed
               Depends: mongodb-org-mongos but it is not going to be installed
               Depends: mongodb-org-tools but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

所以它说它不存在所以在$ sudo apt-get install mongodb-org我得到之后:

Reading package lists... Done
Building dependency tree
Reading state information... Done
mongodb-org is already the newest version (3.6.17).
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 mongodb-org : Depends: mongodb-org-server but it is not going to be installed
               Depends: mongodb-org-mongos but it is not going to be installed
               Depends: mongodb-org-tools but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

在这两种情况下我都尝试过,apt --fix-broken install但都无济于事。

$ mongo当我打字时

MongoDB shell version v3.6.17
connecting to: mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb
2020-03-31T18:26:22.472+0000 W NETWORK  [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2020-03-31T18:26:22.472+0000 E QUERY    [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:263:13
@(connect):1:6
exception: connect failed

我读到过关于揭露、启用或任何类型的 mongodb 交互的信息:

2020-03-31T18:26:22.472+0000: command not found
-bash: connect@src/mongo/shell/mongo.js:263:13: No such file or directory
@(connect):1:6: command not found
exception:: command not found
-bash: root@ubuntu-s-1vcpu-1gb-fra1-01:/home/name#: No such file or directory

我正在执行与之前访问数据库相同的所有操作......不知道发生了什么......谢谢你们。

答案1

看来你通过添加额外的内容弄乱了你的存储库mongodb-org存储库。

尝试注释掉它的源代码/etc/apt/sources.list.d/mongodb-org-4.2.list或类似的文件。

然后做sudo apt update && sudo apt install -f

然后再试一次:sudo apt install mongodb等等。

相关内容