install mongodb debian code example

Example 1: mongodb install in ubuntu

sudo apt update
sudo apt install -y mongodb
//checking service and db
sudo systemctl status mongodb
or service mongodb status
//start service
sudo systemctl start mongod
or service mongodb start
//stop service
sudo systemctl stop mongod  or
service mongodb stop

Example 2: install mongodb debian 10

curl -fsSL https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -Copy

Example 3: install mongodb debian 10

sudo add-apt-repository 'deb https://repo.mongodb.org/apt/debian buster/mongodb-org/4.2 main'Copy

Example 4: install mongodb debian 10

sudo apt updatesudo apt install mongodb-orgCopyCopy