Magento is a popular e-commerce platform that is well-suited to be installed on a cPanel server. Please note that this is third-party software that cPanel neither designs nor maintains and can only provide limited support for its installation. This guide aims to help you to install Magento, but if you run into issues unrelated to your cPanel software, you may need to seek assistance from a qualified System Administrator. At the bottom of this guide are direct links to other resources you can use to troubleshoot issues with your Magento installation.
- First, some dependencies need to be installed for Magento to function properly. The following articles can help you to install Libsodium and Elasticsearch, as well as to enable PHP Composer on the server:
How to Install the Sodium Cryptographic Library (libsodium) and PHP Extension on cPanel.
How To Install & Run Elasticsearch.
- If you haven't already, register an account with Magento here:
- Log in to your account and navigate to the following link:
- From the "Marketplace" tab, click on "Access Keys"
- From the "Magento 2" tab, choose "Create a New Access Key"
This will generate a Public and Private key that you will need in the coming steps:
- Log in to your server using SSH as the user you wish to install Magento for, not as root. Shell access for user accounts is not enabled by default, you may need to enable it first:
Shell access is not enabled on your account
If you have never used SSH to access your server, the following articles will serve as a good primer before continuing:
How to log into server using SSH?
How to SSH using Putty
SSH as a cPanel user
- Within your SSH session as the user, access the document root directory public_html:
- Use PHP Composer to install Magento to this account. There are two versions to install, Open Source or Commerce. Run only one of the following commands to install the different versions, substituting the <install-directory-name> with the name of the folder you wish to install Magento into:
Magento Open Source:
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition <install-directory-name>Magento Commerce:
composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition <install-directory-name>For more information about the different versions of Magento, see the following:
- Magento will ask for your Username and Password. Enter the Public Key generated in Step 5 as your Username. Enter the Private Key generated in Step 5 as your Password.
- PHP Composer will create a Magento project using the Open Source or Commerce package, depending on the command you ran in Step 8.
- When PHP Composer is finished, you will need to create a new database for your Magento software to use. The following article will walk you through the process of creating a database and the required credentials:
How to create a database and database user in cPanel
- The final step is to install Magento. This must be done through the SSH connection, as the web-based Setup Wizards have been either deprecated or removed. Navigate to the folder you installed Magento into and the bin subfolder:
- Run the installation command. This command includes several variables you need to set before executing the command, so do not forget to fill it with the relevant data. It will ask for your admin contact information and site URL. The database name, user, and password will be what you created in Step 11:
./magento setup:install --admin-firstname your_first_name --admin-lastname your_last_name --admin-email your_email_address --admin-user your_username --admin-password your_password --base-url https://your_domain.tld --db-host localhost --db-name your_databse_name --db-user your_databse_username --db-password your_database_passwordThese are the minimum parameters required to install Magento. More are available that can be reviewed at the official documentation here:
- Magento will provide you with an admin login address when the installation is complete. These will be different for every Magento installation:
[SUCCESS]: Magento installation complete.To reach your Magento admin panel, append the directory given to your domain name and the folder it was installed to: https://your_domain.tld/install-directory-name/admin_qjwunj
[SUCCESS]: Magento Admin URI: /admin_qjwunj.
Congratulations! Your installation of Magento is complete!
If you are stuck or found any error during the installation please visit the Magento help center:
Or contact Magento support directly here: