Introduction
How to install Magento!
Procedure
Installing Magento can be complex for the first time.
Before installation, we need to do some prerequisites.
We need to install Libsodium and install Elasticseach, and also we need to enable PHP Composer on the server.
To install them, please flow these articles:
https://support.cpanel.net/hc/en-us/articles/360055446413-How-To-Install-Run-Elasticsearch.
https://docs.cpanel.net/knowledge-base/web-services/how-to-set-up-php-composer.
As a first step, you will need to register a Magento account https://account.magento.com/customer/account/create/.
Login to your account.
Now navigate to https://marketplace.magento.com/customer/account.
Please click on the Market place and under My products and click on Access Keys.
Here click on the Magento2 tab and Create A New Access Key
After this, your Public and Private key will be generated for you. You will need these when the composer crates your Magento2 project.
For the next step, you will need to login to your server using SSH. To access your server via SSH first, you will need to enable SSH access to your account; to do this, please follow the article:
Also, these articles will explain how you can log in to your server using SSH.
https://support.cpanel.net/hc/en-us/articles/360051594713-SSH-as-a-cPanel-user
https://support.cpanel.net/hc/en-us/articles/1500002278202-How-to-SSH-using-Putty
https://support.cpanel.net/hc/en-us/articles/360053610794-How-to-log-into-server-using-SSH-
Now that you are logged in. You will need to navigate to your public_html to do this; use thefollwing command:
cd public_html/
Now copy the Magento version you would like to install. Currently, you can choose the Magento Open Source version or the Magento Commerce version. For more information, visit https://magento.com/compare-open-source-and-magento-commerce.
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>
Now, copy the command of your Magento version and insert it into your SSH console, and hit enter.
Now, as a next step, the Magento repository will ask for your username and password. To your username, you will need to copy and paste your Public key that we have generated. For the password, please copy and paste your Private key and hit enter.
Now composer will create a Magento project using the Magento Open Source or Magento Commerce metapackage.
When the composer is finished, you will need to create a database for your new Magento site.
To do this, please follow our article:
The final step is to install Magento. Please note that you can only use CLI to install Magento; the Web Setup Wizard is deprecated as of Magento 2.3.6 and removed in Magento 2.4.0. As an alternative, use the command line to install or upgrade Magento, as well as extensions.
you will need to navigate to your_magento_folder/bin/
cd your_magento_folder/bin/
And you will need the run the installation command, please do not forget to modify the script and fill up with your data:
./magento setup:install --admin-firstname Your_first_name --admin-lastname Your_first_lastname --admin-email Your_email_address --admin-user Your_username --admin-password Your_password --base-url https://your_domain.tld --db-host Your_databse_host --db-name Your_databse_name --db-user Your_databse_username --db-password Your_database_password
These are the minimum parameters that are required to install Magento. If you want to add more parameters, please follow the official Magento documentation:
https://devdocs.magento.com/guides/v2.4/install-gde/install/cli/install-cli.html
At the end of the installation, you will receive the admin login address, for example:
[SUCCESS]: Magento installation complete.
[SUCCESS]: Magento Admin URI: /admin_qjwunj
To reach your Magento admin site, type in your browser: https://your_domain.tld/admin_qjwunj
Please note that this is just an example you can be different.
And congratulations, your Magento site is now installed and ready to use.
If you are stuck or found any error during the installation please visit Magento help center:
https://support.magento.com/hc/en-us/categories/115000200533-Troubleshooting
Or contact with Magento support:
https://support.magento.com/hc/en-us/articles/360019088251-Submit-a-support-ticket