Table of Contents
What you will read?
MongoDB 7.0 runs smoothly on Ubuntu 25.04 once the repository is added, the packages are installed, and the service is enabled. This setup provides a reliable foundation for database operations.
Step 1: Import MongoDB Public GPG Key
Importing the MongoDB GPG key ensures that the MongoDB packages are trusted and verify their integrity during installation.
curl -fsSL https://pgp.mongodb.com/server-7.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg --dearmor
Step 2: Create MongoDB Source List File
Add the MongoDB repository to your system’s package source list to download the latest MongoDB packages compatible with Ubuntu 25.04.
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
Step 3: Update the Package Database
Refreshing the package index makes the system aware of the newly added MongoDB repository and available packages.
sudo apt update
Step 4: Install MongoDB Packages
Install the official MongoDB server packages along with command-line tools and components needed for running MongoDB.
sudo apt install -y mongodb-org
Step 5: Start and Enable MongoDB Service
Start the MongoDB service and configure it to start automatically on system boot.
sudo systemctl start mongod
sudo systemctl enable mongod
Step 6: Verify MongoDB Installation
Check the status of the MongoDB service to ensure it is running properly.
sudo systemctl status mongod
Expected output snippet:
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2025-04-01 12:34:56 UTC; 1min ago
Step 7: Connect to MongoDB Shell
Use the MongoDB shell to verify database connectivity and perform basic commands.
mongosh
If installed correctly, the prompt changes to:
test>
With MongoDB 7.0 installed on Ubuntu 25.04, the service is active and accessible through MongoDB Shell. The system is now ready to store and manage data efficiently.
For more tutorials and guides, visit DropVPS.com – your trusted source for VPS and server solutions.
