← Volver al blog

How to Install MongoDB on Ubuntu

  • Xernode
  • 1 min de lectura
  • 10 de abril de 2026
Database ubuntu vps database mongodb nosql

Introduction

MongoDB is a popular NoSQL database for modern applications. This guide shows you how to install MongoDB on your Ubuntu VPS.

Step-by-step Guide

  1. Import the MongoDB public GPG key
    • wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
  2. Add the MongoDB repository
    • echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu $(lsb_release -cs)/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
  3. Update your package list
    • sudo apt update
  4. Install MongoDB
    • sudo apt install -y mongodb-org
  5. Start and enable MongoDB
    • sudo systemctl start mongod
    • sudo systemctl enable mongod
  6. Check MongoDB status
    • sudo systemctl status mongod
  7. (Optional) Test MongoDB shell
    • mongosh

Recommendations

  • Secure MongoDB by binding to localhost or setting up authentication.
  • Regularly back up your databases.
  • Keep MongoDB updated for security and performance.

Call To Action

eed a VPS for your MongoDB projects? Check out our hosting plans: https://xernode.com/#pricing

Related Guides