How to install Magento 2.4.0

03 Aug 2020
Magento has been providing Magento 2.4.0 version recently with a range of new features, improvements, component updates and excellent product stability. In this topic, we will discuss how to install Magento 2.4 version.

Magento 2.4 is the next major version of the most anticipated e-commerce platform today. Although we have heard many rumors about this version, not to mention the official statement. We will use composer to manage Magento components and their dependencies. Advantages of using Composer to obtain Magento software metadata:

  • Reuse third-party libraries without including them with the source code

  • Reduce extended conflicts and compatibility issues by using component-based architecture with strong dependency management

  • Comply with the standards of the PHP-Framework Interactive Group (FIG)

  • Repackage Magento open source with other components

  • Use Magento software in a production environment

Step 1: Prerequisites

Before you begin, you need to set up the following:

First, you need to set up a server that meets system requirements that include required software to run the Magento application, supported web browsers, and also recent requirements to securely connect with Magento’s software repository and with PayPal. To be able to do this you need to make the following requirements:

1. Magento 2.4 technology stack requirements:

Operating systems (Linux x86-64)

Linux distributions, such as Red Hat Enterprise Linux (RHEL), CentOS, Ubuntu, Debian, and similar. Magento is not supported on: Windows OS and Mac OS

Memory requirement

Now upgrade Magento apps and extensions you get from Magento Market and other sources that may need up to 2GB of RAM.

Note: If you are using a system with less than 2GB of RAM, you should create a swap file or your upgrade may fail.

Composer

Composer is required if you want to develop the Magento extension.

Web servers

In addition, you must enable the Apache mod_rewrite and mod_version modules. The mod_rewrite module enables the server to perform URL rewriting. The mod_version module provides flexible version checking for different httpd versions. For more information, see our Apache documentation.

Database

  • MySQL 8.0 for on-premise installations

  • MariaDB 10.4 for Magento Commerce Cloud projects

 Note: Magento is also compatible, but has not been tested and is not recommended, with MySQL 5.7.9, MariaDB 10.2, and Percona 5.7.

PHP

  • ~7.4.0

Magento 2.4.0 can be installed with 7.3, but it is not tested or recommended. It is intended for upgrading from Magento 2.3.x to Magento 2.4.0.

Elasticsearch

As of Magento 2.4.0, MySQL is no longer used for search. You must use Elasticsearch. Magento supports Elasticsearch 7.6.x.

SSL

  •  A valid security certificate is required for HTTPS.
  • Self-signed SSL certificates are not supported.

Transport Layer Security (TLS) requirement - PayPal and repo.magento.com both require TLS 1.2 or later

Technologies Magento can use

  • Redis version 5.0 is recommended and used in testing for page caching and session storage

  • Varnish version 6.x (tested with 6.3.1)

  • RabbitMQ 3.8.x

  • RabbitMQ can be used to publish messages to queue and to define the consumers that receive the messages asynchronously.

2. Supported browsers

Storefront and Admin:

  • Microsoft Edge, latest–1

  • Firefox latest, latest–1 (any operating system)

  • Chrome latest, latest–1 (any operating system)

  • Safari latest, latest–1 (Mac OS only)

  • Safari Mobile for iPad 2, iPad Mini, iPad with Retina Display (iOS 12 or later), for desktop storefront

  • Safari Mobile for iPhone 6 or later; iOS 12 or later, for mobile storefront

  • Chrome for mobile latest–1 (Android 4 or later) for mobile storefront

  • TLS requirement for repo.magento.com

3. TLS 1.2 requirement for PayPal

PayPal recently announced they will require Transport Layer Security (TLS) version 1.2 to process payments in a live environment. (PayPal already requires TLS 1.2 in the sandbox.)

Symptoms

  • If you have an earlier version of TLS, you’ll see the errors discussed in this section.

Downloading a Magento metapackage

The following error displays if you attempt to run composer create-project to get a Magento metapackage:

  
    [Composer\Downloader\TransportException]
    The "https://repo.magento.com/packages.json" file could not be downloaded: Failed to enable crypto
    failed to open stream: operation failed
   

Solution

The solution to this issue depends on how your operating system packages TLS. 

  • TLS 1.2 requirement for PayPal

  • TLS 1.2 requirement for PayPal

PayPal recently announced they will require Transport Layer Security (TLS) version 1.2 to process payments in a live environment. (PayPal already requires TLS 1.2 in the sandbox.)

  
   *Unknown SSL protocol error* in connection to api-3t.sandbox.paypal.com:-9824
  

 or 

 

   140062736746144:error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number:s3_pkt.c:337:

   ... (more messages) ...

   New, (NONE), Cipher is (NONE)
   Secure Renegotiation IS NOT supported*
   Compression: NONE
   Expansion: NONE
   SSL-Session:
   Protocol: SSLv3*

   ... (more messages) ...

Description
The source of the issue is your version of libcurl. libcurl versions earlier than 7.34 use TLS 1.1 or earlier by default.

To determine the version of libcurl you’re running, enter the following command on the server that processes PayPal transactions:


    curl --version

Solution

The source of the issue is that the libcurl library packaged with CentOS 6.6 and earlier use TLS 1.1 or earlier by default.

To determine the version of CentOS your server runs, enter the following command:


   cat /etc/*release* 

You have the following options:

  • (Recommended). Upgrade your Magento server to CentOS 6.8 or later.

  • (Less secure, not recommended). Upgrade to libcurl 7.34 or later on CentOS 6 using a non-recommended third-party repository.

4. TLS requirement for repo.magento.com

The Magento software and component repository, repo.magento.com, recently started requiring Transport Layer Security (TLS) 1.1 or later.

Symptoms

If you have an earlier version of TLS, you’ll see the errors discussed in this section.

Downloading a Magento metapackage

The following error displays if you attempt to run composer create-project to get a Magento metapackage:

  
    [Composer\Downloader\TransportException]
    The "https://repo.magento.com/packages.json" file could not be downloaded: Failed to enable crypto
    failed to open stream: operation failed
  

Second, you need to create the owner of the Magento file system that is sometimes referred to as the command-line user.

Third, you must  install Composer

Four, you need to Get the authentication key for the Magento code archive. To create authentication keys:

  1. Log in to the Magento Marketplace. If you don’t have an account, click Register.
  2. Click your account name in the top-right of the page and select My Profile.

  3. Click Access Keys in the Marketplace tab.

  4. Click Create a New Access Key. Enter a specific name for the keys (e.g., the name of the developer receiving the keys) and click OK.

  5. New public and private keys are now associated with your account that you can click to copy. Save this information or keep the page open when working with your Magento project. Use the Public key as your username and the Private key as your password.

                Note: 

                how to install Magento 2.4

                Step 2: Get the metapackage

                To get Magento metapackage:

                Firstly log into your Magento server as or switch to Magento file system owner.

                Then change the docroot directory of the web server or the directory you have configured as the virtual server docroot.

                Finally create a new Composer project using either Magento or Magento Commerce open source metapackage.

                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> 
                  
                

                When prompted, enter your Magento authentication keys. Public and private keys are created and configured in your Magento Market.

                If you encounter an error, such as Cannot find package ... or ... no matching package found, make sure there are no typos in your command. If you keep getting the error, you may not be allowed to download Magento Commerce. Please contact us for assistance!

                Example - Minor release

                Minor releases contain new features, quality fixes, and security fixes. Use Composer to specify a minor release. For example, to specify the Magento Commerce 2.4.0 metapackage:

                  
                    composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition=2.4.0 <install-directory-name>
                  
                

                Example - Quality patch

                Quality patches primarily contain functional and security fixes. However, they can also sometimes contain new, backward-compatible features. Use Composer to download a quality patch. For example, to specify the Magento Commerce 2.4.0 metapackage:

                  
                   composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition=2.4.0 <install-directory-name>  composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition=2.4.0 <install-directory-name>
                  
                

                Example - Security patch

                Security patches contain security fixes only. They are designed to make the upgrade process faster and easier. To download Magento Commerce 2.4.0 metapackage

                  
                    composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition=2.4.0 <install-directory-name>
                  
                

                Step 3: Set file access

                You must set read-write permissions for the web server group before installing Magento software. It is necessary so that the command line can write the file to the Magento file system.

                  
                   cd /var/www/html/<magento install directory>
                   find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
                   find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +
                   chown -R :www-data . # Ubuntu
                   chmod u+x bin/magento
                  
                

                Step 4: Install Magento 2.4.x version

                  
                    php bin/magento setup:install -base-url=http://demo01.mage-world.com --db-host=<your_db_host> --db-name=<your_db_name> --db-user=<your_db_username> --db-password=<your_db_password> --admin-firstname=admin --admin-lastname=admin [email protected] --admin-user=admin --admin-password=admin123 --language=en_US --currency=USD --timezone=America/Chicago --use-rewrites=1
                  
                

                Common errors when installing Magento:

                1. During installation, Reflection Exception error

                During the installation, a message similar to the following displays:

                  
                    [ERROR] exception 'ReflectionException' with message 'Class Magento\Framework\StoreManagerInterface does not exist'
                    in /<path>/lib/internal/Magento/Framework/Code/Reader/ClassReader.php
                  
                

                Solution

                Clear all directories and files under Magento’s var subdirectory and install the Magento software again.

                As the Magento file system owner or as a user with root privileges, enter the following commands:

                  
                    cd <your Magento install directory>/var
                    rm -rf cache/* di/* generation/* page_cache/*
                  
                


                2. During installation, fatal PDO error displays

                  
                    PHP Fatal error:  Class 'PDO' not found in /var/www/html/magento2/setup/module/Magento/Setup/src/Module/Setup/ConnectionFactory.php on line 44
                  
                

                Solution:

                Make sure you installed all required PHP extensions .

                Install PHP 7.4 extensions for Magento 2.4

                
                    apt-get -y install php7.4-opcache php7.4-xml php7.4-gd php7.4-mysql php7.4-intl php7.4-mbstring php7.4-bcmath php7.4-json php7.4-iconv php7.4-soap php7.4-curl php7.4-zip
                 
                

                3. Installation is stuck at 65% “installing user configuration”

                This problem is by apache mod_rewrite was not enabled.

                Solution:

                For Apache 2.4 instructions:

                Use this section to enable Apache 2.4 rewrites and specify a setting for the distributed configuration file, .htaccess.

                Magento uses server rewrites and .htaccess to provide directory-level instructions for Apache.

                + To enable the Apache rewrite module, enter the following command:

                a2enmod rewrite

                + Add the following lines to my /etc/apache2/sites-available/my.host.com

                  
                   <Directory /var/www/html/m2>
                         Options Indexes FollowSymLinks MultiViews
                         AllowOverride All
                         Order allow,deny
                         allow from all
                   </Directory>
                  
                


                + Then run:

                service apache2 restart

                4. Check PHP installation

                The most common error when installing Magento 2 is always_population_raw_post_data. That means having a wrong configuration in your php.ini file causes the error. The readiness check will display this error as:

                Solution:

                Go to your root folder and find the PHP folder. Another solution to locate your php.ini file:

                • Use command: php -i

                • Including <? php phpinfo(); ?>in your protect file.

                Then when you locate the php.ini, open the file and find always_populate_raw_post_data, once located remove the semicolon or just comment before the line of code and change the On or 1 to -1. It would show up like:

                  
                   ;always_populate_raw_post_data = On
                  
                

                After completing to edit this code and remove the semicolon, comment and change the values to -1 it would display like:

                  
                   always_populate_raw_post_data = -1
                  
                

                And by that it means the setting is turned on and given a value of -1 and the PHP Settings Check Error is fixed.









                Related Posts

                7 Useful And Easy Ways To Optimize Your Magento 2.3 In Only 15 Minutes

                7 Useful And Easy Ways To Optimize Your Magento 2.3 In Only 15 Minutes

                16 Oct 2019
                How to optimize a website using Magento 2.3.3? This guide will help you speed up your site and increase SEO point on all Search Engines as Google, Bing,...
                Create latest news block via frontend in Magento 2

                Create latest news block via frontend in Magento 2

                13 Oct 2015
                Today, I will continue introducing you how to create latest news block and use the configuration via backend to display it (Left, Right, Disable) with Magento 2 Frontend. We will use the Tutorial_SimpleNews module in the last post.
                Create the news detail page via frontend in Magento 2

                Create the news detail page via frontend in Magento 2

                07 Oct 2015
                Today, I will continue introducing you about working with Magento 2 Frontend. We will continue using the Tutorial_SimpleNews module in the last post.
                Create the news list page via frontend in Magento 2

                Create the news list page via frontend in Magento 2

                05 Oct 2015
                We are happy to introduce you a series of tutorial on how to display data via frontend in Magento 2.This series is quite long then we will divide it into several parts.