Installing Magento [version 2.4]Magento 2.4 does not have a web-based installer and needs to be installed through the command line. Magento 2.4 also requires a running Elasticsearch 7 instance, as it no longer supports MySQL as a search engine, nor lower Elasticsearch versions. If your plan supports it, you can install and run Elasticsearch locally as a WebApp. Instructions are available in the following article: How to install and run Elasticsearch as a WebApp. If you would like to configure Elasticsearch later, the Elasticsearch modules need to be disabled before Magento is installed. In this guide, we will disable the Elasticsearch modules before we install Magento. This will allow you to install Magento and develop your online store without Elasticsearch. Keep in mind that disabling the Elasticsearch modules will cause the search function in your Magento store to stop working. In order for this guide to work, you will need to download the Magento installation package without sample data. Installing the package with sample data requires Elasticsearch to be available for the installation to complete. You need to follow these steps to install Magento 2.4: 1. Download the installation files from the site of the vendor.Magento can be obtained from:
Once you have downloaded the archive that contains the installation files, you need to upload it to your hosting space. 3. Create a database and a database user.You need to create a MySQL database for the Magento application. You can do this through your web hosting Control Panel's MySQL Databases section. It is recommended that you create the database with the utf8mb4_general_ci collation.
Save the name of the MySQL database, the MySQL user, and the MySQL password for later (e.g. you can write the MySQL credentials in a temporary text file on your computer).
Magento 2.4 requires PHP 7.4 or a newer version. You can check the PHP version used by your domain/subdomain through the hosting Control Panel > PHP Settings section. Changing the PHP version is covered in the PHP Version article. 5. Log in to your account over SSH.Log in to your account over SSH. Logging in over SSH is covered in the SSH section in our documentation. Then, navigate to the directory that contains the extracted Magento installation files. You can do this by running the following command (make sure you replace the path in the command with the actual path to your installation): cd /path/to/your/magento/installation/dir 6. Run the installation script.Run the installation script by executing the following command: php bin/magento setup:install --base-url=http://yourdomain.com/magento/ --db-host=db_host --db-name=username_database --db-user=db_username --db-password=db_password --admin-firstname=Your_first_name --admin-lastname=Your_last_name --admin-email=youremail@yourdomain.com --admin-user=adminusername --admin-password=adminpassword --language=en_US --currency=CUR --timezone=Continent/City --use-rewrites=1 In this command, each of the options should be set as follows: --base-url - The URL where your Magento installation will be accessible.
The full list of the options supported by the installation script can be obtained at https://devdocs.magento.com/guides/v2.4/install-gde/install/cli/install-cli-install.html. The installation script should fail with the following error message: 7. Disable the Elasticsearch modules.To disable the Elasticsearch modules, please run the following command in the Magento installation directory: php bin/magento module:disable Magento_Elasticsearch Magento_Elasticsearch6 Magento_Elasticsearch7 You should get the following output: 8. Run the installation script after the Elasticsearch modules have been disabled.Finally, re-run the installation command: php bin/magento setup:install --base-url=http://yourdomain.com/magento/ --db-host=db_host --db-name=username_database --db-user=db_username --db-password=db_password --admin-firstname=Your_first_name --admin-lastname=Your_last_name --admin-email=youremail@yourdomain.com --admin-user=adminusername --admin-password=adminpassword --language=en_US --currency=CUR --timezone=Continent/City --use-rewrites=1 Please allow some time for the installation script to complete its execution. You should get the following output: 9. Cron jobIn order for Magento to run properly, it requires a cron job. Setting up Cron jobs is covered in the Cron Jobs section of our documentation. To set up a cron job for Magento, please create a file called magento-cron.sh on your account. You can create the file by using the File Manager in the Control Panel, SSH, or FTP. The file should have the following content: #!/bin/bash Then, set up the magento-cron.sh file to run as a Cron job through the Cron Jobs section of the account's Control Panel. That's it!Magento is now installed. You should be able to access its default home page at the URL you specified as the --base-url option in the installation command. It should look like this: You should be able to access the administrative interface of Magento by adding the Magento Admin URI produced by the installation script to your base URL (e.g. http://yourdomain.com/magento/admin_uniquecode). |