Install an extension using Composer
Before you can install any extension in Magento 2, you must create a Magento Marketplace account and an access key pair in the “Access Keys” section.
Once you have your Magento Marketplace keys ready, proceed to install the extension. For example:
$ sudo composer require mailchimp/mc-magento2
The system will prompt for authentication. Use your Magento Marketplace keys as described in the Magento documentation and proceed to download the extension.
Once this process is complete, update the Magento configuration to add the new extension as shown below:
$ sudo magento-cli setup:upgrade
Some specific extensions may require some additional steps, so it is always recommended to carefully check the installation instructions of the extension.