How to install MongoDb on Ubuntu and Azure?

Follow the following instructions to install MongoDb on Ubuntu

https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/

Or execute the following commands

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4

echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list

sudo apt-get update

sudo apt-get install -y mongodb-org

After installing, you can start MongoDb

sudo service mongod start

Some commands for daily use

sudo service mongod stop
sudo service mongod restart
sudo service mongod status

To allow remote connection for Azure, open the port

Edit /etc/mongod.conf

# network interfaces
net:
  port: 27017
  bindIp: 0.0.0.0

Leave a Reply

Your email address will not be published. Required fields are marked *