簡體   English   中英

MongoDB安裝問題Linux Mint Debian

[英]MongoDB installation problems Linux Mint Debian

由於某些Dpkg錯誤,MongoDB無法正確安裝。 嘗試清除或刪除任何相關的東西只是錯誤。 我嘗試刪除所有Mongodb庫,並搜索了其他文件。 我不確定是什么原因導致了原始錯誤或如何使系統恢復到可工作狀態:

Setting up mongodb-org-server (2.6.5) ...
invoke-rc.d: unknown initscript, /etc/init.d/mongod not found.
dpkg: error processing mongodb-org-server (--configure):
subprocess installed post-installation script returned error exit status 100
Errors were encountered while processing:
mongodb-org-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

這是原始安裝命令

$ sudo apt-get install -y mongodb-org
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra 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 115 MB of archives.
After this operation, 290 MB of additional disk space will be used.
Get:1 http://downloads-distro.mongodb.org/repo/ubuntu-upstart/ dist/10gen mongodb-org-               shell amd64 2.6.5 [4,458 kB]
Get:2 http://downloads-distro.mongodb.org/repo/ubuntu-upstart/ dist/10gen mongodb-org-    server amd64 2.6.5 [9,446 kB]                                                                                   
Get:3 http://downloads-distro.mongodb.org/repo/ubuntu-upstart/ dist/10gen mongodb-org-    mongos amd64 2.6.5 [7,175 kB]                                                                                   
Get:4 http://downloads-distro.mongodb.org/repo/ubuntu-upstart/ dist/10gen mongodb-org-    tools amd64 2.6.5 [93.7 MB]                                                                                     
Get:5 http://downloads-distro.mongodb.org/repo/ubuntu-upstart/ dist/10gen mongodb-org amd64 2.6.5 [3,656 B]                                                                                           
Fetched 115 MB in 4min 20s (441 kB/s)                                                                                                                                                                 
Selecting previously unselected package mongodb-org-shell.
(Reading database ... 165525 files and directories currently installed.)
Unpacking mongodb-org-shell (from .../mongodb-org-shell_2.6.5_amd64.deb) ...
Selecting previously unselected package mongodb-org-server.
Unpacking mongodb-org-server (from .../mongodb-org-server_2.6.5_amd64.deb) ...
Selecting previously unselected package mongodb-org-mongos.
Unpacking mongodb-org-mongos (from .../mongodb-org-mongos_2.6.5_amd64.deb) ...
Selecting previously unselected package mongodb-org-tools.
Unpacking mongodb-org-tools (from .../mongodb-org-tools_2.6.5_amd64.deb) ...
Selecting previously unselected package mongodb-org.
Unpacking mongodb-org (from .../mongodb-org_2.6.5_amd64.deb) ...
Processing triggers for man-db ...
Setting up mongodb-org-shell (2.6.5) ...
Setting up mongodb-org-server (2.6.5) ...
Adding system user `mongodb' (UID 120) ...
Adding new user `mongodb' (UID 120) with group `nogroup' ...
Not creating home directory `/home/mongodb'.
Adding group `mongodb' (GID 126) ...
Done.
Adding user `mongodb' to group `mongodb' ...
Adding user mongodb to group mongodb
Done.
invoke-rc.d: unknown initscript, /etc/init.d/mongod not found.
dpkg: error processing mongodb-org-server (--configure):
 subprocess installed post-installation script returned error exit status 100
Setting up mongodb-org-mongos (2.6.5) ...
Setting up mongodb-org-tools (2.6.5) ...
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 mongodb-org (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mongodb-org-server
 mongodb-org
E: Sub-process /usr/bin/dpkg returned an error code (1)

嘗試使用此初始化腳本。 init.d中

如果您以前安裝過MongoDB,請先將其卸載。

刪除МongoDB。 sudo apt-get remove mongodb-10gen之后,刪除confing文件和init腳本sudo find /etc/ | grep mongod.* | xargs rm -rf sudo find /usr/bin/ | grep mongod.* | xargs rm -rf sudo find /var/lib/ | grep mongod.* | xargs rm -rf sudo find /etc/ | grep mongod.* | xargs rm -rf sudo find /usr/bin/ | grep mongod.* | xargs rm -rf sudo find /var/lib/ | grep mongod.* | xargs rm -rf

警告! / var / lib /可能包含您的數據庫。

安裝MongoDB

apt-get autoremove
apt-get -f install

值得嘗試,如果它不起作用,實際上我的mongodb-org-server處於半配置狀態,沒有常規的刪除方法。 然后我找到了最糟糕的解決方案,那就是刪除程序包狀態塊 但是您將無法跟蹤實際的包裝狀態,並在系統中留下垃圾。 因此,我檢查了錯誤消息,發現這一行很有趣:

invoke-rc.d: unknown initscript, /etc/init.d/mongod not found.

然后,我創建一個空文件來欺騙invoke函數。

touch /etc/init.d/mongod

然后再次嘗試apt-get autoremove,並apt-get成功刪除軟件包!

運行此代碼

觸摸/etc/init.d/mongod

然后點擊該鏈接https://community.c9.io/t/setting-up-mongodb/1717

注意:(--rest)在最新版本的mongo中已刪除。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM