To setup and install MongoDB community server on Azure or AWS, the recommended way is to install using the image available in the cloud marketplaces. Deploy a MongoDB server running community edition on Ubuntu Server or CentOS Server.
Using MongoDB Community Server
MongoDB uses the mongo shell to interact with MongoDB
Most Unix-like operating systems limit the system resources that a process may use. These limits may negatively impact MongoDB operation, and should be adjusted. See UNIX ulimit Settings for the recommended settings for your platform.
Starting in MongoDB 4.4, a startup error is generated if the ulimit value for number of open files is under 64000.
Directories on Ubuntu
The data directory /var/lib/mongodb and the log directory /var/log/mongodb are created during the installation.
Directories on CentOS
The data directory /var/lib/mongo and the log directory /var/log/mongodb are created during the installation
By default, MongoDB runs using the mongodb user account. If you change the user that runs the MongoDB process, you must also modify the permission to the data and log directories to give this user access to these directories.
The official MongoDB package includes a configuration file (/etc/mongod.conf). These settings (such as the data directory and log directory specifications) take effect upon startup. That is, if you change the configuration file while the MongoDB instance is running, you must restart the instance for the changes to take effect.
Running MongoDB on Ubuntu: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/#run-mongodb-community-edition
Running MongoDB on CentOS: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/#run-mongodb-community-edition
MongoDB Firewall Ports
MongoDB uses the following default TCP firewall ports: