我无法在 14.04.5 LTS 上安装 mongodb,Trusty Tahr。我试过几次,但都无济于事!:(
1.
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
结果:
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.PWO8RTLTt2 --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyring /etc/apt/trusted.gpg.d/fkrull-deadsnakes.gpg --keyring /etc/apt/trusted.gpg.d/git-core-ppa.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
gpg: requesting key 91FA4AD5 from hkp server keyserver.ubuntu.com
gpg: key 91FA4AD5: public key "MongoDB 3.6 Release Signing Key <[email protected]>" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)`
2.
$ echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
结果:
deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.6 multiverse`
3.
$ sudo apt-get update
输出没有错误。
4.
$ sudo apt-get install -y mongodb-org
结果:
...
invoke-rc.d: unknown initscript, /etc/init.d/mongod not found.
dpkg: error processing package mongodb-org-server (--configure):
subprocess installed post-installation script returned error exit status 100
Setting up mongodb-org-mongos (3.6.2) ...
Setting up mongodb-org-tools (3.6.2) ...
dpkg: dependency problems prevent configuration of mongodb-org:
mongodb-org depends on mongodb-org-server; however:
Package mongodb-org-server is not configured yet.
dpkg: error processing package mongodb-org (--configure):
dependency problems - leaving unconfigured
Processing triggers for ureadahead (0.100.0-16) ...
Errors were encountered while processing:
mongodb-org-server
mongodb-org
E: Sub-process /usr/bin/dpkg returned an error code (1)`
我对此无能为力。
我也尝试通过以下命令重新安装:
$ sudo apt-get --reinstall install mongodb
但即使这样也无济于事。
结果:
Removing mongodb-org-server (3.6.2) ...
invoke-rc.d: unknown initscript, /etc/init.d/mongod not found.
dpkg: error processing package mongodb-org-server (--remove):
subprocess installed pre-removal script returned error exit status 100
invoke-rc.d: unknown initscript, /etc/init.d/mongod not found.
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 100
Removing mongodb-org-mongos (3.6.2) ...
Removing mongodb-org-shell (3.6.2) ...
Removing mongodb-org-tools (3.6.2) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Errors were encountered while processing:
mongodb-org-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
发生了什么?
答案1
Upstart 任务描述文件/etc/init.d/mongod
似乎丢失了。由于无论如何都要删除该软件包,因此您可以(可能)简单地提供一个空描述作为占位符来完成软件包删除:
sudo touch /etc/init.d/mongod
sudo apt install -f