What you will read?
MongoDB 6.0 can be installed on Debian 12.11 by preparing the system, adding the official repository, and configuring the service to run automatically. These steps ensure a stable and secure database environment.
Step 1: Update System Packages
Synchronize your package lists to ensure the latest versions of software are available for installation.
sudo apt update -y sudo apt upgrade -y
Step 2: Import MongoDB Public GPG Key
MongoDB packages are signed with a GPG key. Importing the key allows your system to verify package authenticity.
curl -fsSL https://pgp.mongodb.com/server-6.0.asc | sudo gpg --dearmor -o /usr/share/keyrings/mongodb-server-6.0.gpg
Step 3: Add MongoDB Repository
Add the official MongoDB repository to your apt sources list for Debian 12.11. This provides access to MongoDB installation packages.
echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg ] https://repo.mongodb.org/apt/debian bookworm/mongodb-org/6.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
Step 4: Reload Package Database
Update your package lists again to include MongoDB packages from the newly added repository.
sudo apt update
Step 5: Install MongoDB Packages
Install the latest stable MongoDB server and tools available in the repository.
sudo apt install -y mongodb-org
Step 6: Start and Enable MongoDB Service
Start the MongoDB service immediately and configure it to launch automatically after system reboot.
sudo systemctl start mongod sudo systemctl enable mongod
Step 7: Verify MongoDB Service Status
Confirm MongoDB is running and active on your Debian 12.11 system.
sudo systemctl status mongod
Sample output indicating it is active:
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: active (running) since ...
Step 8: Test MongoDB Connection
Connect to MongoDB shell to verify the database server is responsive.
mongosh
Successful connection prompt:
mongosh>
MongoDB 6.0 is now installed and running on Debian 12.11. The service is active, ready for connections, and can be used to manage data for applications of any scale. For more tutorials and guides, visit DropVPS.com – your trusted source for VPS and server solutions.




