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.

H…


This content originally appeared on DEV Community and was authored by arielro85

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"


This content originally appeared on DEV Community and was authored by arielro85


Print Share Comment Cite Upload Translate Updates
APA

arielro85 | Sciencx (2023-04-20T18:40:18+00:00) Installing MongoDB in WSL2 with Ubuntu-22.04. Retrieved from https://www.scien.cx/2023/04/20/installing-mongodb-in-wsl2-with-ubuntu-22-04/

MLA
" » Installing MongoDB in WSL2 with Ubuntu-22.04." arielro85 | Sciencx - Thursday April 20, 2023, https://www.scien.cx/2023/04/20/installing-mongodb-in-wsl2-with-ubuntu-22-04/
HARVARD
arielro85 | Sciencx Thursday April 20, 2023 » Installing MongoDB in WSL2 with Ubuntu-22.04., viewed ,<https://www.scien.cx/2023/04/20/installing-mongodb-in-wsl2-with-ubuntu-22-04/>
VANCOUVER
arielro85 | Sciencx - » Installing MongoDB in WSL2 with Ubuntu-22.04. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/04/20/installing-mongodb-in-wsl2-with-ubuntu-22-04/
CHICAGO
" » Installing MongoDB in WSL2 with Ubuntu-22.04." arielro85 | Sciencx - Accessed . https://www.scien.cx/2023/04/20/installing-mongodb-in-wsl2-with-ubuntu-22-04/
IEEE
" » Installing MongoDB in WSL2 with Ubuntu-22.04." arielro85 | Sciencx [Online]. Available: https://www.scien.cx/2023/04/20/installing-mongodb-in-wsl2-with-ubuntu-22-04/. [Accessed: ]
rf:citation
» Installing MongoDB in WSL2 with Ubuntu-22.04 | arielro85 | Sciencx | https://www.scien.cx/2023/04/20/installing-mongodb-in-wsl2-with-ubuntu-22-04/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.