我发现 MongoDB 不支持 Ubuntu 的非 LTS 版本。我尝试安装 Ubuntu 提供的非官方 mongodb 包,但是安装不成功:
$ sudo apt install mongodb
[sudo] password for nabhoneel:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libboost-chrono1.62.0 libboost-program-options1.62.0 libgoogle-perftools4
libtcmalloc-minimal4 libunwind8 libyaml-cpp0.5v5 mongo-tools mongodb-clients
mongodb-server
The following packages will be REMOVED:
mongodb-org-server
The following NEW packages will be installed:
libboost-chrono1.62.0 libboost-program-options1.62.0 libgoogle-perftools4
libtcmalloc-minimal4 libunwind8 libyaml-cpp0.5v5 mongo-tools mongodb
mongodb-clients mongodb-server
0 upgraded, 10 newly installed, 1 to remove and 20 not upgraded.
Need to get 0 B/48.5 MB of archives.
After this operation, 183 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 288023 files and directories currently installed.)
Removing mongodb-org-server (3.0.15) ...
Failed to stop mongod.service: Unit mongod.service not loaded.
invoke-rc.d: initscript mongod, action "stop" failed.
dpkg: error processing package mongodb-org-server (--remove):
subprocess installed pre-removal script returned error exit status 5
Errors were encountered while processing:
mongodb-org-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
我试过这个方法:如何在 Ubuntu 17.10 上安装和保护 MongoDB 3.6(在 Medium.com 上)
那也没有用。
我根本不是专家,但常见的问题似乎是启动 MongoDB 服务。但是,不安装服务如何启动呢?
如果有人能帮我解决这个问题,那将非常有帮助,否则,我将不得不安装一些其他(官方)兼容的 Linux 版本。