For Ubuntu 16.04


Setting up mongo:

echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee 
/etc/apt/sources.list.d/mongodb-org-3.4.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo service mongod start

Open access from outside:

Change value of bindIp from 127.0.0.1 to 0.0.0.0 inside /etc/mongod.conf

sudo service mongod restart

Whitelist your ip:

sudo ufw default deny incoming
sudo ufw allow ssh
sudo ufw allow from YOUR IP HERE
sudo ufw enable