Categories: Tips

init script for mongodb 4 on WSL in ubuntu 18.04

If you try to start mongodb on WSL using systemd you will be getting this error.

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

There seems to be no init script for mongodb 4 on ubuntu 18.04(may be other versions too). This makes it complicated for starting mongodb in WSL as systemctl is not supported on WSL. Inorder to have a init script so that you can start using service mongodb start we need to have the init file.

Thankfully init file is already provivided by mongodb here

https://raw.githubusercontent.com/mongodb/mongo/master/debian/init.d

Follow the below steps to get the mongodb running on WSL

  • sudo curl -o /etc/init.d/mongodb https://raw.githubusercontent.com/mongodb/mongo/master/debian/init.d
  • sudo chmod +x mongodb
  • sudo service mongodb start

This should successfully start mongodb.

Njoy smile

Mithun

Recent Posts

Quick release mount systems Compatibility chart

Plate Base FALCAM F38 Ulanzi Uka PGYTECH SNAPLOCK PeakDesign Falcam F38 ⬤ ✕ ✕ ✕…

6 months ago

Happy New Year 2025

I really thought I would keep up with the blog in 2024. But, it didn't…

8 months ago

Happy New Year 2024

Oh boy, there were a lot of things that happened this year. Like last year,…

2 years ago

Happy New Year 2023

This has become a abandoned blog. I will try to fix things this year. More…

3 years ago

Happy New Year 2022

Let me start off by saying, i have more blog posts this year than the…

4 years ago

Fix for xbox “This App Needs a Few Things That Are Missing on this PC”

This happened because your windows has run out of space. If you get this error…

4 years ago

This website uses cookies.