Close Up Photo of Mining Rig

Install MongoDB 6.0.3 on Ubuntu 22.04

Harness the power of MongoDB 6.0.3 on your Ubuntu 22.04 system! This comprehensive guide walks you through the installation process, configuration, and security best practices, ensuring a smooth and secure deployment.

  • Verify MongoDb Installed or Not
mongod --version  
  • Install MongoDB 6.0.3 on Ubuntu 22.04
  • Installation Process depends on MongoDB Version and Ubuntu Version
wget -qO - | sudo apt-key add -

echo "deb [ arch=amd64,arm64 ] jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list

sudo apt update

sudo apt upgrade

sudo apt install mongodb-org
  • Verify MongoDb Installed or Not
mongod --version  
  • Enable MongoDB to start at system startup
sudo systemctl enable mongod
  • Start MongoDB
sudo service mongod start
  • Check MongoDB Status
sudo service mongod status 

How to Configure MongoDB

  • Open and Edit MongoDB config file
sudo nano /etc/mongod.conf
  • Make below changes in config file
  authorization: enabled
  port: 27017
  • Check Port is Allowed through Firewall
sudo ufw status verbose
  • If Port is not Allowed then Allow it through Firewall
sudo ufw allow 27017
  • Restart MongoDB
sudo service mongod restart
  • Confirm if MongoDB is allowing remote connections
sudo lsof -i | grep mongo