Install Magento 2.4 in Windows 10 using composer and command line with Elasticsearch

Posted at: January 31, 2021 6:38 PM

In this post we will learn, download the Magento 2.4 using composer and install the Magento 2.4 software from the command line on localhost windows 10.


Before you continue, you must do the following:

PHP Configuration

Edit php.ini file for increase memory limit and enable required extensions. You can required extensions from this link System Requirements. In xampp server maximum extensions enable.

Also need to change below in php.ini:

Increase memory limit


Enable below extensions by remove semicolon(;) from begining of the line.


Get Authentication Keys

Get authentication keys form Magento officeal website after login. After login you can get Access Keys, public key and private key. Public key is username and private key is password. We will use this creadentials for download Magento using composer.

Install Composer

Download compser version 1.10.20 from this link Install Composer. After download composer.phar file paste there you want download Magento.

For example, we can paste composer.phar file in c:\xampp\htdocs

Download Magento 2.4 Using Compser

Now download Magento 2.4 using composer using below command.

For example

Note: After download magento create zip file for creating next project or reintall magento. Because Magento download via composer is taking 15-20 min.

Install Elasticsearch

Download Elasticsearch according your operating system. In this lesson we have used Windows 10. After download Elasticsearch zip file and paste in C drive and unzip this zip file. And run below command.

After run Elasticsearch, we can check url http://localhost:9200 in browser then we can see output like below.

Create Database

Create database for your project. In this lesson we have created database magento241

Install Magento 2.4 via Command Line

Now we will install Magento 2.4 via command line on windows localhost. If you want to install Magento on localhost then need to changes in file vendor\magento\framework\Image\Adapter\Gd2.php like below code.

Replace with

After above changes then run below command for install Magento 2.4

php bin/magento setup:install --base-url=http://localhost/magento241/ --db-host=localhost --db-name=magento241 --db-user=root --db-password= --admin-firstname=Amit --admin-lastname=Kumar --admin-user=admin --admin-password=admin123 --language=en_US --currency=USD --timezone=America/Chicago --use-rewrites=1 --search-engine=elasticsearch7 --elasticsearch-host=localhost --elasticsearch-port=9200

Fixed Admin Login Issue

After installatin if showing black page on admin login page then need changes in file vendor\magento\framework\View\Element\Template\File\Validator.php like below code.

Replace with

Disable TwoFactorAuth Module

In localhost you can disable module Magento_TwoFactorAuth via running below command.

Fixed Icon and Images Loading Issue

If images and icons is not loading then run below commands

I hope after follow the above steps, Magento 2.4 installation will be success!!



In this lesson we have learnt download Magento 2.4 via composer and install of Magento 2.4 via command line on localhost windows 10. I have also learnt installation of Elasticsearch on windows 10.

This lesson also available on YouTube
install magento 2.4 in windows 10 download magento 2.4 using composer install magento 2.4 using command line install elasticsearch install magento 2.4 with elasticsearch install magento 2.4 on localhost

Please leave comments