MongoDB is one of the most popular NoSQL databases around. In this tutorial we'll be covering how to install the latest version of MongoDB Community Server from its official repository, and the following steps work for Ubuntu 20.04 LTS (Focal), 18.04 LTS (Bionic) and 16.04 LTS (Xenial).
Alternatively, you can install the specific version of MongoDB with the .deb packages provided from the official download page(not recommended):
Download page of MongoDB
Prerequisites
We'll first import the signing key from MongoDB to verify we're downloading from its official, then add the repository to our package lists so we can install it with APT.
Import GPG Key
Install gnupg if you don't have it on your system already: