Reputation: 1149
After successfully installing both MySQL and Spark on Google Colab I have become more ambitious and am trying to install, MongoDB on Google Colab ( instead of a physical Ubuntu 18.04.5 machine) and am getting stuck with
System has not been booted with systemd as init system (PID 1). Can't operate.
Since in Colab, I am the root user, I do not need to prefix my commands with sudo. During the process ... my steps are as follows
!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
this is where it fails with
System has not been booted with systemd as init system (PID 1). Can't operate.
I would be grateful if someone can give me a work around this problem.
Upvotes: 1
Views: 2655
Reputation: 40838
!apt install mongodb
!service mongodb start
from pymongo import MongoClient
client = MongoClient()
client.list_database_names() # ['admin', 'local']
Upvotes: 1