我已经尝试过多次清除并重新安装mongo db,但在安装时不断出现以下错误。当试图安装额外的软件包并试图删除mogodb、mongodb客户端和mongodb服务器时,似乎出现了问题:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
mongodb-org-database-tools-extra mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools
The following packages will be REMOVED:
mongodb mongodb-clients mongodb-server
The following NEW packages will be installed:
mongodb-org mongodb-org-database-tools-extra mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools
0 upgraded, 6 newly installed, 3 to remove and 23 not upgraded.
3 not fully installed or removed.
Need to get 0 B/49.8 MB of archives.
After this operation, 124 MB of additional disk space will be used.
(Reading database ... 268876 files and directories currently installed.)
Removing mongodb (1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5) ...
Removing mongodb-server (1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5) ...
Removing mongodb-clients (1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5) ...
Selecting previously unselected package mongodb-org-shell.
(Reading database ... 268856 files and directories currently installed.)
Preparing to unpack .../0-mongodb-org-shell_4.4.6_amd64.deb ...
Unpacking mongodb-org-shell (4.4.6) ...
Preparing to unpack .../1-mongodb-org-server_4.4.6_amd64.deb ...
Unpacking mongodb-org-server (4.4.6) ...
dpkg: error processing archive /tmp/apt-dpkg-install-i8t6ED/1-mongodb-org-server_4.4.6_amd64.deb (--unpack):
trying to overwrite '/usr/bin/mongod', which is also in package mongodb-server-core 1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../2-mongodb-org-mongos_4.4.6_amd64.deb ...
Unpacking mongodb-org-mongos (4.4.6) ...
dpkg: error processing archive /tmp/apt-dpkg-install-i8t6ED/2-mongodb-org-mongos_4.4.6_amd64.deb (--unpack):
trying to overwrite '/usr/bin/mongos', which is also in package mongodb-server-core 1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Selecting previously unselected package mongodb-org-database-tools-extra.
Preparing to unpack .../3-mongodb-org-database-tools-extra_4.4.6_amd64.deb ...
Unpacking mongodb-org-database-tools-extra (4.4.6) ...
Selecting previously unselected package mongodb-org-tools.
Preparing to unpack .../4-mongodb-org-tools_4.4.6_amd64.deb ...
Unpacking mongodb-org-tools (4.4.6) ...
Selecting previously unselected package mongodb-org.
Preparing to unpack .../5-mongodb-org_4.4.6_amd64.deb ...
Unpacking mongodb-org (4.4.6) ...
Errors were encountered while processing:
/tmp/apt-dpkg-install-i8t6ED/1-mongodb-org-server_4.4.6_amd64.deb
/tmp/apt-dpkg-install-i8t6ED/2-mongodb-org-mongos_4.4.6_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
如果我尝试使用解决问题
sudo apt --fix-broken install
我再次收到这些错误:
dpkg: error processing archive /var/cache/apt/archives/mongodb-org-server_4.4.6_amd64.deb (--unpack):
trying to overwrite '/usr/bin/mongod', which is also in package mongodb-server-core 1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../mongodb-org-mongos_4.4.6_amd64.deb ...
Unpacking mongodb-org-mongos (4.4.6) ...
dpkg: error processing archive /var/cache/apt/archives/mongodb-org-mongos_4.4.6_amd64.deb (--unpack):
trying to overwrite '/usr/bin/mongos', which is also in package mongodb-server-core 1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/mongodb-org-server_4.4.6_amd64.deb
/var/cache/apt/archives/mongodb-org-mongos_4.4.6_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
附加信息:
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
看起来从我的计算机中清除mongodb的其他尝试都不够,但我找到了这个解决方案:
sudo apt remove mongodb
sudo apt purge mongodb
sudo apt autoremove
这删除了mongodb的所有实例,并重新安装它,没有产生任何错误