Are you trying to learn how to install a Magento 2 extension? You can do it in two ways — using Composer or a .zip file. Although Adobe recommends using Composer, we’ll teach you both ways.
The steps to install Magento extensions are similar to those required to install a Magento theme, with a few crucial differences.
For instance, when installing a theme using a .zip archive, you must place the theme files in the app/design/frontend directory. In contrast, when installing a Magento 2 extension using a .zip file, you need to place the files in the app/code directory.
Are you ready to learn more?
Here’s what we’ll cover in this tutorial:
How To Install a Magento 2 Extension
1. Upload the Magento 2 extension files to your server.
2. Extract the .zip extension file.
3. Verify and copy the Magento extension files into the app/code folder.
4. Install the Magento 2 extension and check its status.
5. Clear Magento cache and disable maintenance mode.
Before we show you how to install a Magento 2 extension, make sure you backup your server, set pre-install file permissions, enable developer mode, and put Magento in the maintenance mode.
It also helps to install the extension on a testing server or local development environment to check for extension compatibility.
Get fully managed Magento hosting
Accelerate your store’s potential, without the tedious maintenance
Step 1: Upload the Magento 2 Extension Files to Your Server
Log in to your Magento server as the file system owner.
Upload the .zip archive file to a new folder inside your user’s home directory using SSH or SFTP.
Step 2: Extract the .zip Extension File
Extract the .zip extension file into a new folder called extension using:
$ unzip .zip -d /home/magento/extension
Once you finish the extension installation process, you can delete this folder using:
$ rm -R /home/magento/extension
Step 3: Verify and Copy the Magento Extension Files Into the app/code Folder
Navigate to the Magento project root directory and copy the extension files to the app/code folder using:
$ cp -R /home/magento/extension/* app/code
The app/code directory doesn’t exist in the default Magento filesystem. If this is your first attempt to install a Magento extension manually, create the directory using:
$ mkdir app/code
Step 4: Register the Magento 2 Extension and Check Its Status
Complete the Magento 2 extension installation process by executing:
$ php bin/magento setup:upgrade
$ php bin/magento setup:di:compile
$ php bin/magento setup:static-content:deploy -f
The “setup:upgrade” command registers the Magento 2 extension and updates the Magento database schema and data. The subsequent commands compile Magento code and deploy static view files.
Note: You don’t need to deploy static view files in developer mode unless your extension developer’s documentation mandates it.
Step 5: Update File Permissions and Disable Maintenance Mode
Set file permissions for a production file system based on your hosting setup. Then, disable maintenance mode as follows:
$ php bin/magento maintenance:disable
Congratulations! You’ve successfully learned how to install a Magento 2 extension using Composer.
Final Thoughts: How To Install a Magento 2 Extension
Learning how to install a Magento 2 extension is the best way to add and extend Magento store functionality. Since Adobe deprecated the Web Setup Wizard in Magento 2.3.6 and above, you can only install Magento 2 extensions using the methods described above.
No matter which method you choose, make sure you backup your server before you begin and set production file permissions after you’re done.
If that seems too much work, sign up for managed Magento hosting with Nexcess and enjoy the convenience of automatic nightly backups and a secure Magento 2 hosting environment.
Leave a Reply