Last active
June 19, 2020 00:47
Install mongodb v4 on WSL (windows bash)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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