How to Install MongoDB 6.0.3 on Ubuntu 22.04
Verify MongoDb Installed or Not
Install MongoDB 6.0.3 on Ubuntu 22.04
Installation Process depends on MongoDB Version and Ubuntu Version
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
echo " deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu 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
Enable MongoDB to start at system startup
sudo systemctl enable mongod
sudo service mongod start
sudo service mongod status
Open and Edit MongoDB config file
sudo nano /etc/mongod.conf
Make below changes in config file
security:
authorization: enabled
net:
port: 27017
bindIp: 127.0.0.1
Check Port is Allowed through Firewall
If Port is not Allowed then Allow it through Firewall
sudo service mongod restart
Confirm if MongoDB is allowing remote connections
sudo lsof -i | grep mongo