Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
April 20, 2023 06:40 pm GMT

Installing MongoDB in WSL2 with Ubuntu-22.04

These last days I've been with no time to practice coding, and one thing stopping me was that I didn't have my dev environment as I would like to.
So this week I decided to write this article on how I did to install MongoDB (latest) on my WSL setup.

Head to root folder

cd /

Install GNUPG

sudo apt-get install gnupg

Issue following command to import GPG keys

curl -fsSL https://pgp.mongodb.com/server-6.0.asc | \   sudo gpg -o /usr/share/keyrings/mongodb-server-6.0.gpg \   --dearmor

Create List file

echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list

Reload Packages

sudo apt-get update

Install Mongo db Packages

sudo apt-get install -y mongodb-org

Create DB Folder

mkdir -p data/db

Apply permissions

sudo chown -R `id -un` data/db

Run MongoD

mongod

Verify

You should be able to see something like Waiting for connections","attr":{"port":27017,"ssl":"off" on the terminal.

Hope it helps"


Original Link: https://dev.to/arielro85/install-mongodb-on-wsl2-and-ubuntu2204-33j4

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To