我正在尝试使用(以root身份运行(安装mongodb 4.4:apt install -y 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 : Depends: mongodb-org-mongos but it is not going to be installed
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).
所以我用apt --fix-broken install
得到:
(Reading database ... 72856 files and directories currently installed.)
Preparing to unpack .../mongodb-org-server_4.4.2_amd64.deb ...
Unpacking mongodb-org-server (4.4.2) ...
dpkg: error processing archive /var/cache/apt/archives/mongodb-org-server_4.4.2_amd64.deb (--unpack):
trying to overwrite '/usr/bin/mongod', which is also in package mongodb-server-core 1:3.6.3-0ubuntu1.1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../mongodb-org-mongos_4.4.2_amd64.deb ...
Unpacking mongodb-org-mongos (4.4.2) ...
dpkg: error processing archive /var/cache/apt/archives/mongodb-org-mongos_4.4.2_amd64.deb (--unpack):
trying to overwrite '/usr/bin/mongos', which is also in package mongodb-server-core 1:3.6.3-0ubuntu1.1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../mongodb-database-tools_100.2.1_amd64.deb ...
Unpacking mongodb-database-tools (100.2.1) ...
dpkg: error processing archive /var/cache/apt/archives/mongodb-database-tools_100.2.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-org-server_4.4.2_amd64.deb
/var/cache/apt/archives/mongodb-org-mongos_4.4.2_amd64.deb
/var/cache/apt/archives/mongodb-database-tools_100.2.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
因此,我尝试使用:apt remove mongodb-org
删除mongodb,并得到:
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).
请参阅Mongodb没有从4.2正确更新到4.4。
删除所有已安装的mongodb包,然后安装4.4包。
使用dpkg -l |grep mongodb
查找已安装的。