Home
/
Other Applications
/
How to install new modules and extensions in Magento?

How to install new modules and extensions in Magento?

Install Extensions via Magento Admin Panel

To install a module/extension via Magento’s Admin Dashboard, you should go to the System menu Tools section > Web Setup Wizard. This would redirect you to Setup Wizard page where you should click on the Extension manager option.

This would redirect you to enter your repo.magento.com credentials to connect to Magento Marketplace. You would be redirected to a new page where you may review the extensions you have installed and new ones that you can install. Select the chosen extension by adding a tick in front of it and click Install to initiate the process. This would open a new page where you should initiate Readiness check by clicking on Start Readiness Check.

Once the check is ready and if the extension is compatible with your website, just click on Next. The next step is to choose whether you would like a backup of your application or not.

Once you choose what you want to backup, click on Create Backup. In case you do not want a backup, untick all and click Next.

This would take you to the final step where you should finalize the installation process by clicking on  Install.

Install Extensions Using Composer

For the purpose of this article, we would install the Image Optimizer extension downloaded from Magento Marketplace. Via the Downloads menu at Magento Marketplace you may see the system name of the extension that should be used in the composer.json file. Write it down as you would need it later. In our case – it is apptrian/image-optimizer.

The next step would be to find the composer.json file in your Magento installation’s root folder and find the require section in it. The section should look like the one below:

"require": {
"magento/product-community-edition": "2.2.1",
"composer/composer": "@alpha"
},

To have the apptrian/image-optimizer extension installed using Composer, you should add the following in the require section:

"component-name" : "version"

In our case it would look like as follows:

"apptrian/image-optimizer" : "2.2.1"

You can edit the file by using the File Manager tool in your Site Tools or over FTP. This is how the section looks like after editing it.

"require": {
"apptrian/image-optimizer" : "2.2.1",
"magento/product-community-edition": "2.2.1",
"composer/composer": "@alpha"
},

The next step would be to connect to your account via SSH and navigate to the location of your Magento application. Then update the composer’s dependencies by using the command below.

composer update

This would prompt you to enter your authentication keys. Wait for Composer to finish updating your project dependencies and make sure there aren’t any errors. The output should be similar to the one below.

Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
- Installing apptrian/image-optimizer (2.2.1): Downloading (100%)
Writing lock file
Generating autoload files

This would install the extension but would not enable it. To enable it, list the existing extensions, find the newly installed one and enable it:

php bin/magento module:status
List of disabled modules:
Apptrian_ImageOptimizer
php bin/magento module:enable Apptrian_ImageOptimizer

The final steps to register the changes would require running the commands below.

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:flush

That’s it. Your extension is successfully installed and enabled now.

Share This Article