Install MongoDB in Ubuntu

Create a bash file named install_mongo.bash:

apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 multiverse$
apt-get update
apt-get install -y mongodb-org
sudo systemctl enable mongod
sudo systemctl start mongod

Execute the bash file

sudo bash ./install_mongo.bash

You are ready to use Mongo