我正在使用 Ubuntu 20.04 并尝试安装最新的 mongodb
但是我收到这个错误:
➜ ~
$ sudo apt-get --purge remove mongodb-org
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
mongodb-org-tools : Depends: mongodb-database-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 --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
mongodb-database-tools
The following NEW packages will be installed:
mongodb-database-tools
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
6 not fully installed or removed.
Need to get 0 B/52.7 MB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
(Reading database ... 47772 files and directories currently installed.)
Preparing to unpack .../mongodb-database-tools_100.3.1_amd64.deb ...
Unpacking mongodb-database-tools (100.3.1) ...
dpkg: error processing archive /var/cache/apt/archives/mongodb-database-tools_100.3.1_amd64.deb (--unpack):
trying to overwrite '/usr/bin/bsondump', which is also in package mongo-tools 3.6.3-0ubuntu1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/mongodb-database-tools_100.3.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
➜ ~
` trying to overwrite '/usr/bin/bsondump', which is also in package mongo-tools 3.6.3-0ubuntu1`
Can I just delete that or what?
答案1
您可以使用 dpkg 来修复您的问题。
使用 dpkg 强制安装 mongodb 工具包。
sudo dpkg -i --force-all /var/cache/apt/archives/mongodb-database-tools_100.3.1_amd64.deb
清理所有现有的 mongodb 包。
sudo apt purge mongodb*
安装完成后您应该能够安装最新的 mongodb。