当您尝试使用Debian 8指令时出现错误,表明存在许多缺少的依赖关系,但实际上,如果您安装了一个实际的缺少的依赖关系(libssl1.0.0
),它将起作用。作为参考,要找出缺少的内容,我下载了mongod
二进制文件并查看了ldd
:
adam@debian9:~/mongo/mongodb-linux-x86_64-debian81-3.4.6/bin$ ldd mongod
linux-vdso.so.1 (0x00007ffd0e15d000)
libssl.so.1.0.0 => not found
libcrypto.so.1.0.0 => not found
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f93c6dff000)
*snip*
如果您看一下Debian 9中安装了什么,基本上我们只是发现它们的版本libssl
太新了。在libssl
和libcrypto
库都是由安装libssl
包,它是非常独立的。因此,我们可以抓取Debian 8 libssl1.0.0
软件包并进行安装。
您可以在此处找到该软件包的amd64版本(对于libssl1.0.0 Jesse,仅是Google,而对于另一个版本,则是您的arch)。
要安装该软件包,请下载文件(在我的情况下为“下载”),然后使用进行安装dpkg
:
adam@debian9:~$ sudo dpkg -i /home/adam/Downloads/libssl1.0.0_1.0.1t-1+deb8u6_amd64.deb
Selecting previously unselected package libssl1.0.0:amd64.
(Reading database ... 126471 files and directories currently installed.)
Preparing to unpack .../libssl1.0.0_1.0.1t-1+deb8u6_amd64.deb ...
Unpacking libssl1.0.0:amd64 (1.0.1t-1+deb8u6) ...
Setting up libssl1.0.0:amd64 (1.0.1t-1+deb8u6) ...
完成后,我们将快速重新检查ldd
:
adam@debian9:~/mongo/mongodb-linux-x86_64-debian81-3.4.6/bin$ ldd mongod
linux-vdso.so.1 (0x00007ffdf25de000)
libssl.so.1.0.0 => /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007f86bc12d000)
libcrypto.so.1.0.0 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007f86bbd31000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f86bbb29000)
*snip*
成功!现在,让我们重试以下软件包的安装mongodb-org
:
adam@debian9:~$ sudo apt install mongodb-org
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools
The following NEW packages will be installed:
mongodb-org mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 66.8 MB of archives.
After this operation, 270 MB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.4/main amd64 mongodb-org-shell amd64 3.4.6 [7,980 kB]
Get:2 http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.4/main amd64 mongodb-org-server amd64 3.4.6 [14.2 MB]
Get:3 http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.4/main amd64 mongodb-org-mongos amd64 3.4.6 [8,103 kB]
Get:4 http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.4/main amd64 mongodb-org-tools amd64 3.4.6 [36.5 MB]
Get:5 http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.4/main amd64 mongodb-org amd64 3.4.6 [3,820 B]
Fetched 66.8 MB in 7s (9,509 kB/s)
Selecting previously unselected package mongodb-org-shell.
(Reading database ... 126491 files and directories currently installed.)
Preparing to unpack .../mongodb-org-shell_3.4.6_amd64.deb ...
Unpacking mongodb-org-shell (3.4.6) ...
Selecting previously unselected package mongodb-org-server.
Preparing to unpack .../mongodb-org-server_3.4.6_amd64.deb ...
Unpacking mongodb-org-server (3.4.6) ...
*snip*
Adding system user `mongodb' (UID 119) ...
Adding new user `mongodb' (UID 119) with group `nogroup' ...
Not creating home directory `/home/mongodb'.
Adding group `mongodb' (GID 123) ...
Done.
Adding user `mongodb' to group `mongodb' ...
Adding user mongodb to group mongodb
Done.
Setting up mongodb-org (3.4.6) ...
最后,让我们确保该服务已启动,并且可以连接一个shell:
adam@debian9:~$ sudo systemctl start mongod
adam@debian9:~$ mongo
MongoDB shell version v3.4.6
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.6
一切就在这里-Jesse软件包在Stretch上工作。我确信很快就会有正式发布,这将使它过时,但是与此同时,这是一个相对轻松的解决方法。