Below, we explain how you can install a theme for Magento 2.4.x on our Magento image or any other Magento installation.
Preliminary steps
The first step is to purchase the theme for Magento 2.4.x. We must make sure that the theme we want to install is compatible with the version of Magento 2.4.x we have.
We will also need to upload it to the server, and we have two options:
- The first is to upload the theme via FTP. Remember that the Magento 2.4.x image has an FTP user available for uploading content.
- The second is to copy it over SSH using the SCP command or RSYNC.
Installing the theme in Magento
Depending on the theme, you will need to check the official documentation in case any additional steps are required, but in general, most themes should be installed as follows.
The first step is to extract the theme into the root of the Magento installation. If you are using our Magento image, remember that the installation path is /var/www/html/magento2.
Once the files have been copied, we proceed to upgrade Magento. To do this, you need to connect to the server over SSH to run these commands within the Magento installation path:
# sudo -u www-data php bin/magento setup:upgradeThen we compile the files and create the static files:
# sudo -u www-data php bin/magento setup:di:compile
# sudo -u www-data php bin/magento setup:static-content:deploy -f
Finally, we clear the cache:
# sudo -u www-data php bin/magento cache:clean
# sudo -u www-data php bin/magento cache:flush
After this, we go to the Magento backend and navigate to Content > Configuration:
Under Global, we click edit:
In the list that appears, we must select the installed theme: