Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

How to install a Magento extension from the command line

This guide shows you how to add a Magento extension to your store by typing commands over SSH.

How-To Guides2 min read8 steps

What is a Magento extension?

Magento is software for running an online shop. An extension is an add-on that gives your shop a new feature, such as a payment method or a new report. The command line is a window where you type instructions instead of clicking buttons.

You need SSH access (a safe way to type commands on a server). If you are not sure your plan includes SSH, ask Hostvento support.

Warning

Installing an extension changes your shop. Take a full backup of your files and database first. Try the extension on a test copy if you can.

Steps for Composer extensions

Composer is a tool that downloads PHP add-ons. Most extensions from the Magento Marketplace (the official add-on store) install this way.

  1. Connect to your server with SSH.
  2. Go to your Magento folder:
cd /path/to/your/magento

Use your own path.

  1. Put the shop in maintenance mode. Visitors then see a notice and not a half-finished page:
php bin/magento maintenance:enable
  1. Download the extension. Use the package name from the extension's page:
composer require vendor/module-name

Composer may ask for your Magento Marketplace access keys. You create these in your Marketplace account.

  1. Turn the extension on and update the database:
php bin/magento module:enable Vendor_ModuleName
php bin/magento setup:upgrade

The first line switches the module on. The second one updates your database for it.

  1. Rebuild the compiled code (only needed in production mode):
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f

These steps prepare the code and design files. They can take several minutes.

  1. Clear the cache:
php bin/magento cache:flush
  1. Turn maintenance mode off:
php bin/magento maintenance:disable

If you have a ZIP file instead

Unzip it into app/code/Vendor/ModuleName. Then run steps 5 to 8.

Tip: Check the extension supports your Magento version before you buy or install it.

Quick recap

  • Back up first.
  • Turn on maintenance mode.
  • Add the extension with composer require.
  • Run module:enable and setup:upgrade.
  • Compile, deploy files, flush the cache.
  • Turn maintenance mode off.