How to install Magento 2
Unlike other CMSs, Magento 2 no longer allows installation through a graphical interface in the browser.
Therefore the hosting you buy must be able to give you console access.
Once you have access to your terminal screen, and after making sure you have an environment that meets all of Magento’s minimum requirements, which you can check at the following link, you can proceed with installing Magento 2.
Which command should you run?
This command must be run in the folder where the site is to be created. If written as shown, the folder that will be created is “project-community-edition“, which we can then decide to rename, but if we want to name it in a specific way right away, we just need to add the name, preceded by a space, right after the command.
Another thing to add is the version: if you don’t specify it (as in the following example), the latest available stable version is downloaded; otherwise, just add the version we want to download, this time without a space after “project-community-edition“, preceded by a colon (e.g. “:2.4.6”).
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-editionWith the first command we downloaded the code and all the components needed to have the Magento code. At this point we have to run the following command, replacing the parameters, so that a basic configuration is created that lets us then log in to the site and finish the rest of the configuration in the admin section.
For the following command to work correctly, the database on which Magento will run must already have been created.
bin/magento setup:install \
--base-url=https://localhost.test/ \
--db-host=localhost \
--db-name=db_name \
--db-user=db_user \
--db-password=db_psw! \
--admin-firstname=name \
--admin-lastname=surname \
--admin-email=mail@mail.com \
--admin-user=admin \
--admin-password=adminpsw \
--language=it_IT \
--currency=EUR \
--timezone=Europe/Rome \
--use-rewrites=1