How to Install MongoDB 8 on Ubuntu 24.04 LTS Linux (2024)



**Title: How to Install MongoDB 8 Community Server on Ubuntu 24.04 LTS Using .deb File with MongoDB Compass and mongosh Tools** **Description:** In this tutorial, we’ll walk you through the process of installing MongoDB 8 Community Server on Ubuntu 24.04 LTS Linux using the .deb file. We’ll also cover how to install MongoDB Compass, the graphical interface for MongoDB, and `mongosh`, the MongoDB shell, for efficient database management. Follow these steps to have MongoDB fully set up and ready for development or production on your Ubuntu machine. ### Step-by-Step Guide: #### 1. **Download the .deb Package**: – Head to the [MongoDB Downloads Page](https://www.mongodb.com/try/download/community) and select **Ubuntu** as the operating system, version **24.04 LTS**, and architecture that matches your system. – Download the `.deb` file for MongoDB 8 Community Server to your **Downloads** folder. #### 2. **Install MongoDB from the .deb Package**: – Open the terminal and navigate to the **Downloads** folder where the `.deb` file is stored: “`bash cd ~/Downloads “` – Use the following command to install the `.deb` package: “`bash sudo dpkg -i mongodb-org-server_[version].deb “` – If you encounter any missing dependencies, run: “`bash sudo apt-get install -f “` #### 3. **Start and Enable MongoDB**: – Start MongoDB using the systemctl command: “`bash sudo systemctl start mongod “` – Enable MongoDB to start on boot: “`bash sudo systemctl enable mongod “` #### 4. **Verify MongoDB Installation**: – Confirm MongoDB is running by checking the service status: “`bash sudo systemctl status mongod “` – You can also verify by connecting to MongoDB in the shell: “`bash mongosh “` #### 5. **Install MongoDB Compass**: – Download the **MongoDB Compass** `.deb` package from the [MongoDB Tools page](https://www.mongodb.com/try/download/compass). – In your terminal, navigate to the Downloads folder and install MongoDB Compass: “`bash sudo dpkg -i mongodb-compass_[version].deb “` – If necessary, install any missing dependencies using: “`bash sudo apt-get install -f “` – Launch MongoDB Compass from the applications menu or by running: “`bash mongodb-compass “` #### 6. **Install mongosh (MongoDB Shell)**: – Download `mongosh` from the [MongoDB Shell download page](https://www.mongodb.com/try/download/shell). – In your terminal, navigate to where you saved the `.deb` file and install `mongosh`: “`bash sudo dpkg -i mongodb-mongosh_[version].deb “` – Run `mongosh` in the terminal to connect and manage your databases directly. ### Summary of Installed Components: – **MongoDB 8 Server**: Manages the databases and enables data storage.
– **MongoDB Compass**: Graphical interface to visualize, analyze, and manage MongoDB data.
– **mongosh**: Command-line shell for MongoDB, allowing easy interaction with your databases. ### Troubleshooting Tips: – **Dependency Issues**: If you encounter dependency errors, running `sudo apt-get install -f` often resolves them.
– **Starting MongoDB Automatically**: Verify MongoDB is set to start on boot by checking the service status or adjusting the systemd configuration if needed. With MongoDB 8, MongoDB Compass, and mongosh fully set up, you’re ready to explore the power of MongoDB for your development projects on Ubuntu 24.04. Don't forget to like, subscribe, and hit the bell for more MongoDB and Linux tutorials! **Helpful Resources:** – MongoDB Installation Guide: [MongoDB Documentation](https://docs.mongodb.com)
– MongoDB Compass: [Compass Documentation](https://docs.mongodb.com/compass)
– MongoDB Shell: [mongosh Documentation](https://docs.mongodb.com/mongodb-shell/) #MongoDB #UbuntuLinux #MongoDBInstallation #LinuxTutorial #Database #MongoDBCompass #mongosh #Ubuntu24LTS