Skip to content
Follow
Ubuntu Linux

How to Install MongoDB 8 on Ubuntu 24.04

Richard
Written by
Richard
Mar 14, 2025 Updated Jul 13, 2026 3 min read
How to Install MongoDB 8 on Ubuntu 24.04
How to Install MongoDB 8 on Ubuntu 24.04

MongoDB 8 on Ubuntu 24.04 installs by adding the official MongoDB package list and then using the APT command to put the database server on your system.

MongoDB is a flexible, open-source database that stores information like flexible documents, similar to JSON. This makes it easy to manage data as your applications change and helps your system grow.

This guide walks you through setting up MongoDB 8.0 Community Edition, the newest stable version, on Ubuntu 24.04 LTS. This release brings better performance and new features compared to older versions.

⚡ Quick Answer

Install MongoDB 8 on Ubuntu 24.04 by adding the official repository and using APT. First, install necessary packages with `apt install`, then import the GPG key, add the repository to `sources.list.d`, and finally install with `apt-get install mongodb-org`.

Install MongoDB

Install MongoDB 8 on Ubuntu 24.04 by first updating your system’s software list and installing curl. You’ll then add the official MongoDB source to your system and include a special key. This key makes sure the MongoDB software you download is genuine and safe to use.

🐧Bash / Shell
sudo apt update
sudo apt install curl apt-transport-https gnupg

Next, import the MongoDB public GPG key.

💻Code
curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg --dearmor

Then, add the repository.

Command Prompt
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list

Finally, update and install CouchDB.

🐧Bash / Shell
sudo apt-get update
sudo apt-get install mongodb-org

Start MongoDB

You can start the mongod process by issuing the following command:

🐧Bash / Shell
sudo systemctl start mongod
sudo systemctl enable mongod

Verify that MongoDB has started successfully.

🐧Bash / Shell
sudo systemctl status mongod

The command should output something similar to the one below.

💻Code
mongod.service - MongoDB Database Server
Loaded: loaded (/usr/lib/systemd/system/mongod.service; disabled; preset: >
Active: active (running) since Fri 2025-03-14 09:43:12 CDT; 3s ago
Docs: https://docs.mongodb.org/manual
Main PID: 16283 (mongod)
Memory: 88.3M (peak: 88.5M)
CPU: 201ms
CGroup: /system.slice/mongod.service
└─16283 /usr/bin/mongod --config /etc/mongod.conf

Stop and restart MongoDB

🐧Bash / Shell
sudo systemctl stop mongod
sudo systemctl restart mongod

Remove / Uninstall MongoDB

Uninstall MongoDB 8 from Ubuntu 24.04 by stopping the running MongoDB program first. Then, use your system’s tool to remove the MongoDB software packages. Finally, delete any leftover files and directories to ensure MongoDB is completely removed from your computer.

First, stop MongoDB services.

🐧Bash / Shell
sudo service mongod stop

Then, remove the package and directories.

🐧Bash / Shell
sudo apt-get purge mongodb-org*
sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongodb

That should do it!

Conclusion:

Installing MongoDB 8 Community Edition on Ubuntu 24.04 is a straightforward process that offers a flexible and powerful solution for managing data. Here are the key takeaways:

  • Flexibility: MongoDB allows for dynamic schemas, making it suitable for applications with evolving data requirements.
  • Scalability: Its document-based approach easily accommodates data growth and changing applications.
  • Performance: MongoDB is designed to handle high loads, ensuring efficient performance under various workloads.
  • Easy Installation: The installation steps provided are simple to follow, enabling quick deployment of MongoDB.
  • Comprehensive Management: MongoDB services can be easily managed with basic system commands for starting, stopping, and uninstalling.

Following this guide helps you set up and manage MongoDB, a popular NoSQL database, for your applications on Ubuntu 24.04. This process ensures you have a functional database ready for development.

How to install MongoDB 8?

And once the MongoDB shell setup is is finished. I can open the command prompt. So just type cmd in the search bar and then open the command prompt here. And just type mongo sh here on the terminal.

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

📚 Related Tutorials

How to Install GNOME Desktop on Ubuntu 24.04
Ubuntu Linux How to Install GNOME Desktop on Ubuntu 24.04
How to Install KDE Desktop on Ubuntu 24.04
Ubuntu Linux How to Install KDE Desktop on Ubuntu 24.04

1 Comment

Leave a Comment

Your email address will not be published. Required fields are marked *