MongoDB 在 Google Colab 上:系统尚未使用 systemd 启动

MongoDB on Google Colab : System has not been booted with systemd

在 Google Colab 上成功安装 MySQL 和 Spark 后,我变得更加雄心勃勃,正在尝试安装 MongoDB 在 Google Colab 上(而不是物理 Ubuntu 18.04.5 机器)并且卡在

System has not been booted with systemd as init system (PID 1). Can't operate.

因为在 Colab 中,我是 root 用户,所以我不需要在命令前加上 sudo。过程中...我的步骤如下

!apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 68818C72E52529D4

!echo "deb http://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-4.0.list

!apt-get update

!apt-get install -y mongodb-org

这是它失败的地方

System has not been booted with systemd as init system (PID 1). Can't operate.

如果有人能解决这个问题,我将不胜感激。

!apt install mongodb
!service mongodb start

from pymongo import MongoClient
client = MongoClient()
client.list_database_names() # ['admin', 'local']