MongoDB is a free and open-source document database. It is classified as a NoSQL database which is different than traditional table-based SQL databases like MySQL and PostgreSQL.

In MongoDB, data is stored in flexible, JSON-like documents where fields can vary from document to document. It does not require a predefined schema and data structure can be changed over time.

 MongoDB 6.0 is now generally available and ready for download. MongoDB 6.0 includes the capabilities introduced with the previous 5.1–5.3 Rapid Releases and debuts new abilities to help you address more use cases, improve operational resilience at scale, and secure and protect your data.

MongoDB Lifecycle

VersionRelease DateEnd of life
6.0July 2022July 2025
5.0July 2021October 2024
4.4July 2020February 2024
4.2August 2019April 2023
4.0June 2018April 2022

IMPORTANT : v4.0 reached end of life on April 30, 2022 and is no longer officially supported by MongoDB.

MongoDB 6.0 installation on Linux

Steps to install MongoDB 6.0 on Linux server

Installation of database MongoDB 6.0 on Linux is easy. This guide will help you how to install MongoDB 6.0 Community Edition on Linux server.


  • sudo privileges.
  • Stable internet connection.
  • Disable SELinux and Firewall.

First check server OS version then start installation as per OS version:

# egrep '^(VERSION|NAME)=' /etc/os-release


When you are using any VPS server then you need to verify server compatibility with MongoDB. Please run below command to check server compatibility.

# grep -qm1 '^flags.*avx' /proc/cpuinfo && echo OK || echo NOT OK

If print OK on the console then you can continue with the installation, If print NOT OK then your CPU doesn’t support MongoDB 6.0.

MongoDB Installation on Red Hat family:

Steps to install MongoDB 6.0 on Red Hat Enterprise Linux, CentOS, Oracle Linux, Rocky Linux and Amazon Linux.

Set up MongoDB yum repository for Red Hat Enterprise LinuxCentOS, Oracle Linux and Rocky Linux:

# tee /etc/yum.repos.d/mongodb-org-6.0.repo<<EOM
name=MongoDB Repository

Set up MongoDB yum repository for Amazon Linux 2:

# tee /etc/yum.repos.d/mongodb-org-6.0.repo<<EOM
name=MongoDB Repository

To install MongoDB 6.0, run the following command:

# yum install -y mongodb-org

MongoDB Installation on Debian family:

Steps to install MongoDB 6.0 on Debian and Ubuntu

Install the prerequisites:

# apt install -y curl wget gnupg lsb-release

import the MongoDB public GPG Key

# wget -qO - | sudo apt-key add -

The operation should respond with an OK

Now set up the apt repository as per your Ubuntu version:
Note : For Ubuntu 22.04 (Jammy), MongoDB 6.0 package not available yet on official site so we are installing using repo of Ubuntu 20.04 (Focal).

For Ubuntu 22.04 (Jammy)
# echo "deb [ arch=amd64,arm64 ] jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list

For Ubuntu 20.04 (Focal):
# echo "deb [ arch=amd64,arm64 ] focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list

For Ubuntu 18.04 (Bionic):
# echo "deb [ arch=amd64,arm64 ] bionic/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list

For Ubuntu 16.04 (Xenial):
# echo "deb [ arch=amd64,arm64 ] xenial/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list

Or set up the apt repository as per your Debian version:

For Debian 11 "bullseye"
# echo "deb bullseye/mongodb-org/6.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list

For Debian 10 "Buster"
# echo "deb buster/mongodb-org/6.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list

For Debian 9 "Stretch"
# echo "deb stretch/mongodb-org/6.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list

For Debian 8 "Jessie"
# echo "deb jessie/mongodb-org/6.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list

Then update the local package database:

#  apt update

Then Install the MongoDB 6.0 latest version:

# apt install -y mongodb-org

 Managing the MongoDB service

let’s review some basic management commands.

Verify installed version of MongoDB:

#  mongod -version

Start the MongoDB service:

# systemctl start mongod.service

Check status of the MongoDB service:

# systemctl status mongod.service

If you receive an error or service failed to start then run the following commands:

# systemctl daemon-reload
# chown mongod:mongod /tmp/mongodb-27017.sock
# systemctl start mongod.service

Restart the MongoDB service:

# systemctl restart mongod.service

If you want to stop MongoDB service:

# systemctl stop mongod.service

By default, MongoDB service is disabled to start automatically when the server boots. If you want to enable it at startup, run:

# systemctl enable mongod.service

Re-disable the service to start up at boot:

# systemctl disable mongod.service

Uninstall MongoDB 6.0

To completely remove MongoDB from a system, you must remove the MongoDB applications, the configuration files, and any directories containing data and logs.

WARNING: This process will completely remove MongoDB, its configuration, and all databases. This process is not reversible, so ensure that all of your configuration and data is backed up before proceeding.

Stop the mongod service

# systemctl stop mongod.service

Remove any MongoDB packages that previously installed.

For RHEL / CentOS/ Oracle Linux / Rocky Linux / Amazon Linux

# yum erase $(rpm -qa | grep mongodb-org)

For Ubuntu / Debian

# apt autoremove --purge mongodb-org

Remove MongoDB databases and log files.

# rm -rf /var/log/mongodb
# rm -rf /var/lib/mongo


Congratulations! We’ve installed latest MongoDB 6.0 on Linux system. We hope this 2 minutes stuff helped you and thank you for visiting our website.