Close Menu
JustwebworldJustwebworld
  • Astrology
  • Business & Finance
    • Cryptocurrency
    • Make Money
    • Entrepreneur
    • Brands
    • Companies
    • Personal Finance
      • Banking
      • Insurance
      • Trading and Investing
  • Tech
    • Computing
    • Cybersecurity
    • Electronics
    • Android
    • Apple
    • Gadgets
    • Social Media
    • Mobile Apps
    • Softwares
  • Education
    • Vocabulary
    • Abbreviations
    • General Knowledge
    • Writing & Translation
  • Lifestyle
    • Beauty & Cosmetics
    • Fashion & Style
    • Furniture & Decor
    • Luxury
    • People & Relationships
    • Pets and Animals
    • Shopping
    • Parenting
    • Gardening
    • Birthdays
  • Health
  • Travel
  • Auto
  • Gaming
  • Food
  • Entertainment
  • Sports
Facebook X (Twitter) Instagram Pinterest YouTube LinkedIn WhatsApp Telegram
Thursday, January 22
  • About
  • Contact Us
  • Advertise With Us
  • Disclaimer
  • Terms & Conditions
  • Privacy Policy
JustwebworldJustwebworld
  • Astrology
  • Business & Finance
    • Cryptocurrency
    • Make Money
    • Entrepreneur
    • Brands
    • Companies
    • Personal Finance
      • Banking
      • Insurance
      • Trading and Investing
  • Tech
    • Computing
    • Cybersecurity
    • Electronics
    • Android
    • Apple
    • Gadgets
    • Social Media
    • Mobile Apps
    • Softwares
  • Education
    • Vocabulary
    • Abbreviations
    • General Knowledge
    • Writing & Translation
  • Lifestyle
    • Beauty & Cosmetics
    • Fashion & Style
    • Furniture & Decor
    • Luxury
    • People & Relationships
    • Pets and Animals
    • Shopping
    • Parenting
    • Gardening
    • Birthdays
  • Health
  • Travel
  • Auto
  • Gaming
  • Food
  • Entertainment
  • Sports
JustwebworldJustwebworld
Home » Technology » A Guide to Install MongoDB On Ubuntu

A Guide to Install MongoDB On Ubuntu

By Ashley Judd Technology
Facebook Twitter LinkedIn Telegram Pinterest Reddit WhatsApp
Follow Us
WhatsApp Telegram

Prerequisites.

  • Ubuntu 20.04 server.
  • A sudo user.

Table of Contents

Toggle
  • Introduction to MongoDB
  • Introduction to Ubuntu
  • Install MongoDB on Ubuntu Steps
    • Install MongoDB on Ubuntu Steps: Install MongoDB Server
    • Install MongoDB on Ubuntu Steps: Run MongoDB
    • Install MongoDB on Ubuntu Steps: Configuration
    • Install MongoDB on Ubuntu Steps: Uninstalling MongoDB
  • Conclusion

Introduction to MongoDB

MongoDB is a cross-platform database that uses documents that are JSON-like with schemas that can be customized.

Install MongoDB On Ubuntu

This NoSQL database application focuses on documents and supports search, transactional, mobile, and analytical use cases. MongoDB can deliver these features while employing a robust data model and a developer-friendly query interface.

You can simply preserve data integrity and provide high availability with MongoDB to help your organization flourish. Before moving further, MongoDB verifies that your mission-critical workloads fulfill compliance and security criteria.

With indexing, sharding, pre-built replication, performance tools, and more, MongoDB gives you the confidence to run in production.

Introduction to Ubuntu

Ubuntu is an open-sourced operating system that is based on Linux. It supports computers, cellphones, and network servers. The system was created by Canonical Ltd which is based in the UK.

Install MongoDB on Ubuntu Steps

Here are the key steps that you may implement to install MongoDB on Ubuntu, configure and run it:

Install MongoDB on Ubuntu Steps: Install MongoDB Server

  • Step 1: To import the MongoDB public GPG Key, type the following command in a terminal window.

wget -qO – https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add –

This should respond with an “OK”.

  • Step 2: Create a list file for your MongoDB package under the /etc/apt/sources.list.d directory.

echo “deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse” | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list

  • Step 3: Refresh the local package database.

sudo apt-get update

Also Read: Know How Inverter Batteries Empower Uninterrupted Work From Home Productivity Know How Inverter Batteries Empower Uninterrupted Work From Home Productivity

In the following location, the installation script creates a data directory.

/var/lib/mongodb

MongoDB reports activity logs to a mongod.log file which can be located from this location:

/var/log/mongodb

  • Step 4: Install the MongoDB Packages

sudo apt-get install -y mongodb-org

Despite the fact that you can select any version of MongoDB, apt-get will automatically upgrade the packages whenever a newer version becomes available. You can pin the package to the currently installed version to prevent unwanted upgrades:

echo “mongodb-org hold” | sudodpkg –set-selections

echo “mongodb-org-database hold” | sudodpkg –set-selections

echo “mongodb-org-server hold” | sudodpkg –set-selections

echo “mongodb-org-shell hold” | sudodpkg –set-selections

echo “mongodb-org-mongos hold” | sudodpkg –set-selections

echo “mongodb-org-tools hold” | sudodpkg –set-selections

Install MongoDB on Ubuntu Steps: Run MongoDB

The mongod service manages the MongoDB package. To manage it, use the systemctl commands.

  • Step 1: Check the status.

$ sudosystemctl status mongod

  • Step 2: Start MongoDB.

sudosystemctl start mongod

  • Step 3: Allow MongoDB to be started on boot.

$ sudosystemctl enable mongod

  • Step 4: Verify whether MongoDB has started.

sudosystemctl status mongod

  • Step 5: Stop MongoDB

sudosystemctl stop mongod

  • Step 6: Restart MongoDB

sudosystemctl restart mongod

  • Step 7: Start using MongoDB by starting a mongosh session.

mongosh

Install MongoDB on Ubuntu Steps: Configuration

Because you haven’t configured MongoDB authentication, you’ll get some starting warnings when the service loads.

Current Mongosh Log ID: 612e0b0da174636a8c40e2de

…

Using MongoDB: 5.0.2

Using Mongosh: 1.0.5

…

test >

Step 1: Switch to admin

test > use admin

Step 2: Run the following command to create an administrator user.

admin>db.createUser(

{

user: “mongo_db_admin”,

Also Read: How Technology Will Shape Healthcare How Technology Will Shape Healthcare

pwd: passwordPrompt(),

roles: [ { role: “userAdminAnyDatabase”, db: “admin” }, “root”]

}

)

Enter your password and continue.

Step 3: Exit the command line interface

admin> quit

Step 4: To enable authorization, open the MongoDB file using a nano text editor

$ sudo nano /etc/mongod.conf

Step 5: Locate the security directive that is commented out and change the value.

security:

authorization: enabled.

Save and close the file.

Step 6: Restart the server.

$  sudosystemctl restart mongod

Install MongoDB on Ubuntu Steps: Uninstalling MongoDB

You must delete the MongoDB applications, the configuration files, and any directories containing data and logs to entirely remove MongoDB from a system.

This process is not reversible and it completely removes MongoDB, its configuration, and all of the databases in it, so make sure you backup your data beforehand.

Step 1: Stop MongoDB

sudo service mongod stop

Step 2: Remove all the packages you had installed.

sudo apt-get purge mongodb-org*

Step 3: Delete all the databases and the log files which were created.

sudo rm -r /var/log/mongodb

sudo rm -r /var/lib/mongodb

Conclusion

This blog discusses the steps to install MongoDB on Ubuntu and configure it. This includes a brief about MongoDB and how to run it. It also discusses the steps to uninstall MongoDB from your system.

cards
Powered by paypal
Follow on WhatsApp Follow on Telegram
Share. Facebook Twitter Pinterest LinkedIn Tumblr Telegram WhatsApp Copy Link
Previous ArticleWhat Experience And Skills Do You Need To Work In Medical Translations?
Next Article What Forex Traders Should Know About ECN And How to Use It
Ashley Judd

Ashley Judd is a powerhouse of creativity, turning words into magic across every topic you can think of! Whether it’s tech, lifestyle, health, business, or beyond, she knows how to hook readers with engaging, easy-to-read, and insightful content. Her writing isn’t just informative-it’s entertaining, relatable, and packed with value. With a passion for storytelling and a love for exploring new ideas, Ashley makes every piece she writes a must-read. When she’s not crafting compelling content, you’ll find her buried in books, sipping coffee, or dreaming up her next big writing adventure!

Related Posts

Turn Your Business Email Clutter-Free With Greenmor Mail

CNC Machining, 3D Printing, and Injection Molding: Choosing the Right Process for Your Product Development

JS Precision: How JS Precision Drives Innovation In Aerospace and Medical Manufacturing

From Google Rankings to ChatGPT Answers: Can Tesseract AI Track It All?

Best Laptop Under ₹60,000 In 2025: Is It The Right Balance Between Budget And Performance?

Turn Your Imagination Into Reality With CapCut AI Image Generator

Leave A Reply

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 43.4K other subscribers
Categories
Latest Posts

GTA 6 Feels More Real Than Real Life 😮🎮 — And That Changes Everything

Confident Aging: How Senior Housing Supports Self-Assurance

Low-Deck Single Axle Trailer for Easier Equipment Loading

Why People Watch Less but Scroll More (The Psychology Behind Endless Scrolling)

How Investors Track Down Property Owners Using Public Records

Understand How Wind Emulators Upgrade Renewable Energy Training In Institutes

Expert Tips On Proper Use Of Septic System Cleaning Products

Discover Why An Online Tutor Job In Bangalore Is A Flexible Earning Option

Group Vs Customised Australia Trips: How to Decide What Suits You

What to Know About Choosing the Right Support Path

The content on this website is provided solely for educational and informational purposes. We do not promote, endorse, or deal in any products, services, or activities mentioned. While we strive to share accurate and up-to-date information, we make no warranties regarding completeness, reliability, or accuracy. Any action you take based on the information found here is strictly at your own risk, and we will not be liable for any losses or damages in connection with the use of our website.

DMCA.com Protection Status
Quick Links
Age Calculator
Angel Number Calculator
Case Converter
Sudoku Online
Word Counter
Love Calculator
Jack Doherty YouTuber
Snake Dream Meaning
Get Rid of Cockroaches
Indian Cricket Team Coaches
Best Volleyball Team Names
Useful Links
Number to Words
Period Calculator
Yes-No Picker Wheel
Demon Name Generator
Kingdom Name Generator
Harry Potter Name Generator
Daddy Yankee Biography
Crocodile Dream Meaning
Goa Budget Trip Guide
Maryse Mizanin WWE Diva
Best Cricket Team Names
Helpful Resources
Colors Name In English
Best Computer Brands
WhatsApp Web
Most Beautiful Beaches
Tesla Cybertruck Review
Richest Actors in the World
India Jarvis Actress
Cat Dream Meaning
Belmar Beach New Jersey
Aryna Sabalenka Tennis Superstar
Best WhatsApp Group Names
Explore More
Good Morning Handsome
Best English Songs of All Time
Cricket World Cup Winners
Ways to Say Rest In Peace
Britain’s Got Talent Winners
American Idol Winners
Dude Perfect Net Worth
Horse Dream Meaning
Ramakrishna Beach Visakhapatnam
Anastasia Potapova Tennis Star
Best Funny Team Names
Facebook X (Twitter) Instagram Pinterest YouTube Tumblr LinkedIn WhatsApp Telegram Threads RSS
  • About
  • Contact Us
  • Advertise With Us
  • Disclaimer
  • Privacy Policy
  • Terms & Conditions
  • Web Stories
Copyright © 2012-2026. JustWebWorld - All Rights Reserved.

Type above and press Enter to search. Press Esc to cancel.

×

👇 Bonus Reads for You 🎁

Walmartone 2 Step Verification
wmlink/2step on a Walmart – Walmartone 2 Step Verification
Salesforce CPQ
Salesforce CPQ In Service Cloud Is Scaling Up Its Data Integration Strategy
deletefacebookaccount
How to Permanently Deactivate/Delete Facebook Account?
Cloud Services Can Help Australian Public Sector Organisations
How Cloud Services Can Help Australian Public Sector Organisations