Install MongoDB Community Edition on Ubuntu — MongoDB Manual

Before deploying MongoDB in a production environment, consider the Production Notes document which offers performance considerations and configuration recommendations for production MongoDB deployments.

To install MongoDB Community on your Ubuntu system, these
instructions will use the official mongodb-org package, which is
maintained and supported by MongoDB Inc. The official mongodb-org
package always contains the latest version of MongoDB, and is available
from its own dedicated repo.

Important

The mongodb package provided by Ubuntu is not
maintained by MongoDB Inc. and conflicts with the official
mongodb-org package. If you have already installed the mongodb
package on your Ubuntu system, you must first uninstall
the mongodb package before proceeding with these instructions.

See MongoDB Community Edition Packages for the complete list of official
packages.