在 ubuntu wsl2 systemd 上安装 MongoDB 将 systemd 发布为初始化系统 (PID 1)

installing MongoDB on ubuntu wsl2 systemd issue systemd as init system (PID 1)

正在 ubuntu wsl2

安装 MongoDB

我尝试在 WSL(ubuntu 20) 上安装 MongoDB,在使用 this link 之后,但出现了问题! 我不知道到底是什么:systemd :"System has not been booted with systemd as init system (PID 1)" 以及我应该如何解决... 我完全是 Linux 经验的初学者。 我已经搜索过这个问题,显然,在 wsl 中使用 DOCKTER 的人遇到了这样的问题,但我不知道我应该怎么做。 谢谢

整个错误:

Setting up mongodb-org-server (4.4.4) ...
System has not been booted with systemd as init system (PID 1). Cant operate.
Failed to connect to bus: Host is down
dpkg: error processing package mongodb-org-server (--configure):
installed mongodb-org-server package post-installation script subprocess returned error exit status 1
Setting up mongodb-org-shell (4.4.4) ...
Setting up mongodb-org-mongos (4.4.4) ...
Setting up mongodb-org-database-tools-extra (4.4.4) ...
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
Setting up mongodb-org-tools (4.4.4) ...
  No apport report written because the error message indicates its a followup error from a previous failure.

Processing triggers for man-db (2.9.1-1) ...
Errors were encountered while processing:
  mongodb-org-server
  mongodb-org    

经过大量搜索和反复试验,我发现它显然唯一需要做的是:在 MongoDB 安装(“In this Lik”)之后,我们应该设置“systemctl “ 启用! 然后它需要重新启动您的系统。

sudo systemctl enable MongoDB