Add or connect a database with WSL | Microsoft Docs
To install MongoDB (version 5.0) on WSL (Ubuntu 20.04):
- Open your WSL terminal (ie. Ubuntu) and go to your home directory:
cd ~ - Update your Ubuntu packages:
sudo apt update - Import the public key used by the MongoDB package management system:
wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add - - Create a list file for MongoDB:
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list