I'm following Microsoft's official documentation to install MongoDB in WSL 2.
When I reached the 5th step it returns some error. The step was Reload local package database: sudo apt-get update
Here is the sort form of the error,
Err:1 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 InRelease
Cannot initiate the connection to repo.mongodb.org:443 (2600:9000:213a:6a00:1e:e933:9800:93a1). - connect (101: Network is unreachable) Cannot initiate the connection to repo.mongodb.org:443 (2600:9000:213a:6400:1e:e933:9800:93a1). - connect (101: Network is unreachable) Cannot initiate the connection to repo.mongodb.org:443 (2600:9000:213a:f200:1e:e933:9800:93a1).
CodePudding user response:
WSL2 doesn't support routing IPv6, and for some reason apt is trying to connect to repo.mongodb.org
using IPv6.
Try:
sudo apt update -o Acquire::ForceIPv4=true
This is a workaround (if it works). You may run into other issues with IPv6, and if so, check out this Ask Ubuntu answer and see if that helps.