Last week we discussed the process of installing additional extensions using 'Web setup wizard' present in your Magento 2 webshop.

If you are a developer and/or comfortable with command line interface then there is another (easier!) way to install new extensions in Magento 2.

In this blog post, we are going to explain how you can install extensions in your Magento 2 webshop using the command line.

Before we start, we would like to repeat our usual disclaimer: These actions should be performed by professionals and only after taking backups and other necessary precautions in advance.

We will assume that you have an account at Magento Marketplace and have already purchased/procured the extension that you want to install.

To install extensions via this method, you will need:

  • Access to your Magento webshop server. The user should have enough access to install Magento extensions.
  • Extension’s component name and its version


Step 1: You will need to find out the correct component name and version of the extension that you want to install.

There are 2 ways to find these value:

  1. Login to your account at Magento marketplace and Go to My profile > My purchases.This page will list down all extensions that you have purchased from Marketplace so far. Look for the extension you want to install and click on the 'Technical details' link under it. It will open a small info box which will have 'component name' and 'component version' values displayed in it. You can copy or remember these values as you will need them during installation process.
  2. If you have downloaded the extension files then you can open the file package and find the composer.json file and look for the "name" and "version" of that extension in that file.

Step 2: Now that you know the extension's component name and version, you need to add it to your Magento's composer.json file. Navigate to your Magento root folder and add component name and version details in following format:

composer require <component-name>:<version>

Example:

composer require hs/module-OneStepCheckout:1.8.6

Step 3: It will then ask you for your authentication keys. These are the same keys that you have in your Magento marketplace account. Enter your public key as your username and then type in your private key as the password.

Note: If you do not have these keys then refer to Step 2 of our previous post.

Step 4: Once you enter your keys correctly, the composer will run for sometime. Wait for it finish updating the dependencies. If it displays any errors then make sure that you fix them first and then continue with the installation process again.

Step 5: By this point the Composer would have its job and the next step would be for you to verify the extension. You can do this by running following command:

bin/magento module:status

Your extension will show-up in the list of disabled modules. This way you can verify that the extension is a part of your project file-set now.

Note that extension name will be shown as <VendorName>_<ComponentName>. Hope you noticed that this is not the same name format as the Component name.

Step 6: Now that the extension is there, the next step is to enable it in your webshop. You can do that by running following command:

bin/magento module:enable <VendorName>_<ComponentName> --clear-static-content

Example:

bin/magento module:enable HS_OneStepCheckout --clear-static-content

Once you run that command, it will show you some output informing that the extension was enabled and cache and static view files were cleared successfully.

Note: --clear-static-content part was added to above command so that your static view files also get cleared. This is a necessary step for many extensions.

Step 7: Now you can run your extension registration and recompilation process using following commands one by one:

bin/magento setup:upgrade
bin/magento setup:di:compile

If you face any issues on frontend then you can try clearing cache: bin/magento cache:flush

If the webhop is in production mode then you might want to deploy static view files again:

php bin/magento setup:static-content:deploy

Step 8: That is it! Your extension must be now installed in your Magento 2 store. You can now go to your admin area and start configuring the extension as per the project requirements. Do not forget to follow the extension manual while configuring the extension.

You can always contact us and get all your extensions and themes installed professionally by our Magento experts.

Live chat: cookie consent required

Copyright © Hungersoft 2019

· Terms & Conditions · Privacy policy