Skip to content

Techeons

Imagine | Explore | Innovate

Menu
  • Home
Menu

How to setup MongoDB on Ubuntu

Posted on February 28, 2025

MongoDB is a popular, open-source NoSQL database that allows for flexible and scalable data storage. Here’s a brief overview:

Key Features:

  • Document-based: Stores data in JSON-like documents, making it easy to work with complex data structures.
  • NoSQL: Doesn’t use traditional table-based relational database management systems (RDBMS).
  • Schema-less: No predefined schema, allowing for flexible data modeling.
  • Scalable: Horizontally scalable, handling high traffic and large data volumes.
  • High performance: Supports fast data retrieval and storage.

Basic Concepts:

  • Collections: Groups of related documents, similar to tables in RDBMS.
  • Documents: Individual data records, stored in JSON-like format.
  • Fields: Key-value pairs within documents, similar to columns in RDBMS.

Installation

# Import the public key used by the package management system:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6

# Create a list file for MongoDB:
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list

# Reload the local package database:
sudo apt-get update

# Install the MongoDB packages:
sudo apt-get install -y mongodb-org

# Start MongoDB:
sudo systemctl start mongod

# Enable MongoDB to start on boot:
sudo systemctl enable mongod

# Check the status of MongoDB:
sudo systemctl status mongod

MongoDB should start on Port 27017.

Connect to MongoDB:

$ mongo

Share on Social Media
x facebook pinterest linkedin tumblr reddit emailwhatsapptelegrammastodon

Leave a Reply Cancel reply

You must be logged in to post a comment.

Recent Posts

  • Nginx: How to increase timeout for Nginx
  • Cheat Sheet: Essential Git Commands
  • Setting a default shell in Linux
  • Setting up Composer on Linux
  • Switch easily between Python versions on a Mac using pyenv

Tags

ai alerting aws b2 backblaze certificate cheatsheet cloud commands data-science datalake devops dns docker dremio git gitlab infra jenkins kubernetes linux metabase minikube minio monitoring mount mysql nginx nodejs notebooks openssh php python scala secrets spark ssh ssl ubuntu ufw usb web dev tools windows xampp zeppelin

©2026 Techeons | Design: Newspaperly WordPress Theme