Skip to content

Instantly share code, notes, and snippets.

@h4de5
Last active June 19, 2020 00:47
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save h4de5/50e8af2af791065980820caab81b4350 to your computer and use it in GitHub Desktop.
Save h4de5/50e8af2af791065980820caab81b4350 to your computer and use it in GitHub Desktop.
Install mongodb v4 on WSL (windows bash)
#!/bin/bash
# make sure you are on latest wsl release (bionic)
cat /etc/*release*
# add new repositories
echo "deb [ arch=amd64,i386 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
echo "deb [ arch=amd64,i386 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.1 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.1.list
# try an update (which will fail, but reveal missing keys)
sudo apt-get update
.. yalla yalla...
NO_PUBKEY 68818C72E52529D4
NO_PUBKEY 4B7C549A058F8B6B
.. yalla yalla...
# add those keys to your keyserver
curl -sL "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x68818C72E52529D4" | sudo apt-key add
curl -sL "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x4B7C549A058F8B6B" | sudo apt-key add
curl -sL "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5" | sudo apt-key add
# do the update again
sudo apt-get update
# mongodb is called mongodb-org (!), check version
sudo apt-cache search mongodb-org
sudo apt-cache show mongodb-org
# should show atleast 4.0.4
sudo apt-get install mongodb-org
# to use mongodb in a meteor app located in a windows directory
# you may need to change your .meteor/local path by:
https://github.com/meteor/meteor/issues/9914#issuecomment-405094639
# ffs - if you ever intented to access your mongodb via meteor on wsl it will not work
# error: Error: SQLITE_IOERR: disk I/O error
# see: https://github.com/meteor/meteor/pull/9644
# set this before starting nodejs app
export METEOR_SQLITE_JOURNAL_MODE=TRUNCATE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment