Problem scenario
You want to install MongoDB on an Ubuntu/Debian Linux server. How do you do this?
Solution
1. If you know your distribution of Linux, go to step #2. Otherwise try this command: cat /etc/*-release
2. Do one of the following that corresponds to your distribution of Linux:
On Debian: sudo apt-get -y install mongodb mongodb-server
On Ubuntu 16.x or Ubuntu 17.x run these two commands (that may span three lines):
curl http://repo.mongodb.org/apt/ubuntu/dists/xenial/mongodb-org/3.6/multiverse/binary-amd64/mongodb-org-server_3.6.4_amd64.deb > /tmp/mongodb-org-server_3.6.4_amd64.deb
dpkg -i /tmp/mongodb-org-server_3.6.4_amd64.deb
3. To test: mongod -version
If you want to install MongoDB on a RedHat derivative of Linux, please see this posting.