Menu

1 / 2

Deploying MongoDB NoSQL Document Database on Ubuntu 24.04

DEV Community: mongodb·Sanskriti Harmukh·6 months ago
#nDiiL351
#dev#mongodb#exit#enter#article
Reading 0:00
15s threshold

MongoDB is an open-source NoSQL document database that stores data as flexible BSON documents and scales horizontally through sharding. This guide deploys MongoDB using Docker Compose with persistent volume storage and a root user, then verifies it with the mongosh shell. By the end, you'll have a MongoDB instance ready for application use on your server.

Set Up the Directory Structure

1. Create the project directory structure:

$ mkdir -p ~/mongodb-logging/mongodb-data $ cd ~/mongodb-logging

Enter fullscreen mode

Exit fullscreen mode

2. Create the environment file:

$ nano .env

Enter fullscreen mode

Exit fullscreen mode

MONGO_ROOT_USERNAME = admin MONGO_ROOT_PASSWORD = changeme

Enter fullscreen mode

Exit fullscreen mode

Pick a strong password before deploying.

Deploy with Docker Compose

1.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.