我正在尝试从官方网站在 Ubuntu 19.04 上安装 MongoDB 。但面临错误
尽管我很清楚我的 Ubuntu 版本不是 LTS,但我遵循的程序与官方文档中所写的完全相同。
在安装 MongoDB 命令的最后一步之前,所有步骤都很顺利。你可以在这里看到错误。
vks@247:~$ sudo apt-get 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-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,但它不起作用并显示如下:
vks@247:~$ sudo apt --fix-broken install
[sudo] password for vks:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
libboost-program-options1.67.0 libgoogle-perftools4 libtcmalloc-minimal4 libyaml-cpp0.6 mongo-tools mongodb-server-core
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
mongodb-org-mongos mongodb-org-server mongodb-org-tools
The following NEW packages will be installed:
mongodb-org-mongos mongodb-org-server mongodb-org-tools
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
Need to get 0 B/85.7 MB of archives.
After this operation, 248 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 217305 files and directories currently installed.)
Preparing to unpack .../mongodb-org-server_4.2.5_amd64.deb ...
Unpacking mongodb-org-server (4.2.5) ...
dpkg: error processing archive /var/cache/apt/archives/mongodb-org-server_4.2.5_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-0ubuntu2
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../mongodb-org-mongos_4.2.5_amd64.deb ...
Unpacking mongodb-org-mongos (4.2.5) ...
dpkg: error processing archive /var/cache/apt/archives/mongodb-org-mongos_4.2.5_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-0ubuntu2
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../mongodb-org-tools_4.2.5_amd64.deb ...
Unpacking mongodb-org-tools (4.2.5) ...
dpkg: error processing archive /var/cache/apt/archives/mongodb-org-tools_4.2.5_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.2.5_amd64.deb
/var/cache/apt/archives/mongodb-org-mongos_4.2.5_amd64.deb
/var/cache/apt/archives/mongodb-org-tools_4.2.5_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
在此之后,我也尝试安装指定的版本(尽管它是相同的版本)。
vks@247:~$ sudo apt-get install -y mongodb-org=4.2.5 mongodb-org-server=4.2.5 mongodb-org-shell=4.2.5 mongodb-org-mongos=4.2.5 mongodb-org-tools=4.2.5
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libboost-program-options1.67.0 libgoogle-perftools4 libtcmalloc-minimal4
libyaml-cpp0.6 mongo-tools mongodb-server-core
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
mongodb-org-mongos mongodb-org-server mongodb-org-tools
The following packages will be upgraded:
mongodb-org mongodb-org-shell
2 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 97.7 MB of archives.
After this operation, 255 MB of additional disk space will be used.
Get:1 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2/multiverse amd64 mongodb-org-shell amd64 4.2.5 [12.0 MB]
Get:2 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2/multiverse amd64 mongodb-org-server amd64 4.2.5 [18.5 MB]
Get:3 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2/multiverse amd64 mongodb-org-mongos amd64 4.2.5 [10.2 MB]
Get:4 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2/multiverse amd64 mongodb-org-tools amd64 4.2.5 [57.0 MB]
Get:5 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2/multiverse amd64 mongodb-org amd64 4.2.5 [3,532 B]
Fetched 97.7 MB in 20s (4,836 kB/s)
(Reading database ... 217305 files and directories currently installed.)
Preparing to unpack .../mongodb-org-shell_4.2.5_amd64.deb ...
Unpacking mongodb-org-shell (4.2.5) over (4.0.17) ...
Preparing to unpack .../mongodb-org-server_4.2.5_amd64.deb ...
Unpacking mongodb-org-server (4.2.5) ...
dpkg: error processing archive /var/cache/apt/archives/mongodb-org-server_4.2.5_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-0ubuntu2
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../mongodb-org-mongos_4.2.5_amd64.deb ...
Unpacking mongodb-org-mongos (4.2.5) ...
dpkg: error processing archive /var/cache/apt/archives/mongodb-org-mongos_4.2.5_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-0ubuntu2
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../mongodb-org-tools_4.2.5_amd64.deb ...
Unpacking mongodb-org-tools (4.2.5) ...
dpkg: error processing archive /var/cache/apt/archives/mongodb-org-tools_4.2.5_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)
Preparing to unpack .../mongodb-org_4.2.5_amd64.deb ...
Unpacking mongodb-org (4.2.5) over (4.0.17) ...
Errors were encountered while processing:
/var/cache/apt/archives/mongodb-org-server_4.2.5_amd64.deb
/var/cache/apt/archives/mongodb-org-mongos_4.2.5_amd64.deb
/var/cache/apt/archives/mongodb-org-tools_4.2.5_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
问题保持不变。
我也尝试从各个站点解决此问题,但无法解决。任何帮助将不胜感激。
我遇到了同样的问题,我在安装手册上花了一点力气,找到了这个原因和解决步骤。
因此,您需要删除现有的 mongodb 包,然后进行全新安装。确保在删除现有安装之前进行必要的备份。
1.删除部分安装的mongodb-org包
2.删除现有的mongodb包
3.重新安装mongodb-org
干杯!!
参考