Skip to content

Instantly share code, notes, and snippets.

@gencer
Forked from matinrco/mongodbOnDebianWSL.md
Created April 5, 2021 23:53
Show Gist options
  • Save gencer/e49c1f42b9999d69d887de8e081deb56 to your computer and use it in GitHub Desktop.
Save gencer/e49c1f42b9999d69d887de8e081deb56 to your computer and use it in GitHub Desktop.
Install MongoDB 4.4.1 on Windows 10 WSL 2 (Debian 10/Buster - Ubuntu 20.04 LTS (Focal Fossa))

Install MongoDB 4.4.1 on WSL 2 (Debian 10/Buster - Ubuntu 20.04 LTS (Focal Fossa))

Download these .deb files :

Download this init.d script and save to /etc/init.d/mongod

  • from official mongodb repo : link

  • Or with commands 👇😉

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

Install downloded deb files in this order with these commands

  1. Install mongodb-org-server :
    1. sudo dpkg --unpack mongodb-org-server_4.4.1_amd64.deb
    2. Edit /var/lib/dpkg/info/mongodb-org-server.postinst file and comment the line systemctl daemon-reload. then save and exit.
    3. Run sudo dpkg --configure mongodb-org-server
    4. done. now you can manage service by sudo service mongod start|stop|restart
  2. Install sudo dpkg -i mongodb-org-shell_4.4.1_amd64.deb
  3. Install sudo dpkg -i mongodb-org-mongos_4.4.1_amd64.deb
  4. Install sudo dpkg -i mongodb-org-database-tools-extra_4.4.1_amd64.deb
  5. Install sudo dpkg -i mongodb-database-tools_100.2.0_amd64.deb
  6. Install sudo dpkg -i mongodb-org-tools_4.4.1_amd64.deb
  7. Install sudo dpkg -i mongodb-org_4.4.1_amd64.deb

Done

  • Run sudo apt install -yf to fix any missing dependencies
  • You can verify installed packages by dpkg -l | grep mongodb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment