【问题标题】:MongoDB on Google Colab : System has not been booted with systemdGoogle Colab 上的 MongoDB:系统尚未使用 systemd 启动
【发布时间】:2021-04-06 17:04:12
【问题描述】:

在 Google Colab 上成功安装 MySQL 和 Spark 之后,我变得更加雄心勃勃,我正在尝试在 Google Colab 上安装 MongoDB(而不是物理 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.

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

【问题讨论】:

    标签: mongodb google-colaboratory


    【解决方案1】:
    !apt install mongodb
    !service mongodb start
    
    from pymongo import MongoClient
    client = MongoClient()
    client.list_database_names() # ['admin', 'local']
    

    【讨论】:

    • 谢谢!它必须如此简单!但我想知道为什么 Ubuntu 的文档如此复杂和令人费解! .. 再次感谢您。
    • 我尝试了很多方法,可能两次都失败了。最终,当我找到一种方法时,我将其尽可能简单,并将其保存为要点。 gist.github.com/korakot/64f4e589eff252cf0486388da26c17fd
    猜你喜欢
    • 2020-04-15
    • 1970-01-01
    • 1970-01-01
    • 2019-07-25
    • 1970-01-01
    • 1970-01-01
    • 2021-03-01
    • 1970-01-01
    • 2019-02-11
    相关资源
    最近更新 更多