How to install MongoDb on Ubuntu and Azure?

Follow the following instructions to install MongoDb on Ubuntu

Or execute the following commands

sudo apt-key adv --keyserver hkp:// --recv 9DA31620334BD75D9DCB49F368818C72E52529D4

echo "deb [ arch=amd64 ] 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
  port: 27017

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.