How do I install Magento 2.4.7-p1 to Windows?

Step 1

composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=2.4.7-p1 .

Step 2

Apply the patches for Windows:

  1. How to fix the «Invalid template file» / «require_js.phtml» failure in Windows?
  2. How to fix catalog images in Magento ≥ 2.3.5 in Windows?
    1. It also solves: How to fix «Unable to apply data patch Magento\Theme\Setup\Patch\Data\RegisterThemes for module Magento_Theme» in Magento ≥ 2.3.5 in Windows?
  3. How to fix «file_put_contents(generated/metadata/primary|global|plugin-list.php): failed to open stream: No such file or directory in lib\internal\Magento\Framework\Interception\PluginListGenerator.php on line 414» in Magento 2.4-develop in Windows?
  4. How to fix interceptors generation on bin/magento setup:di:compile in Magento ≥ 2.2 in Windows?

Step 3

Create the database:

mysql -e "CREATE DATABASE justuno_4_247p1"

Step 4

Configure Nginx:

server {
	listen 2257 ssl;
	server_name localhost.com;
	ssl_certificate "C:/server/crt/localhost.com/.crt";
	ssl_certificate_key "C:/server/crt/localhost.com/.key";
	error_page 419 = @magento;
	error_page 420 = @static;
	location /pub/media/ {return 420;}
	location /pub/static/ {return 420;}
	location / {return 419;}
	location @static {
		root C:/work/clients/justuno/m2v/2.4.7-p1/j4/code;
		access_log off;
		expires max;
		try_files $uri @magento;
	}
	location @magento {
		include params_for_proxy;
		proxy_redirect https://localhost.com:12257/ https://localhost.com:2257/;
		proxy_pass https://localhost.com:12257;
	}
}

Step 5

Configure Apache:

Listen 12257
<VirtualHost 127.0.0.1:12257>
	ServerName localhost.com
	DocumentRoot "C:/work/clients/justuno/m2v/2.4.7-p1/j4/code"
	SSLEngine on
	SSLCertificateFile "C:/server/crt/localhost.com/.crt"
	SSLCertificateKeyFile "C:/server/crt/localhost.com/.key"
</VirtualHost>

Step 6

Install the library for Elasticsearch 8:

composer require magento/module-elasticsearch-8 --update-with-all-dependencies

Step 7

bin/magento setup:install \
    --admin-email=admin@mage2.pro \
    --admin-firstname=Dmitrii \
    --admin-lastname=Fediuk \
    --admin-password=Za1112Uj \
    --admin-use-security-key=0 \
    --admin-user="Dmitrii Fediuk" \
    --backend-frontname=admin \
    --base-url-secure=https://localhost.com:2257/ \
    --base-url=https://localhost.com:2257/ \
    --currency=USD \
    --db-host=127.0.0.1 \
    --db-name=justuno_4_247p1 \
    --db-password=vertrigo \
    --db-user=root \
    --elasticsearch-host=127.0.0.1 \
    --elasticsearch-index-prefix=justuno_4_247p1 \
    --language=en_US \
    --search-engine=elasticsearch8 \
    --session-save=files \
    --timezone=Europe/Istanbul \
    --use-rewrites=1 \
    --use-secure-admin=1 \
    --use-secure=1

Step 8

bin/magento module:enable Magento_Elasticsearch8
bin/magento setup:upgrade
bin/magento cache:enable

Step 9

bin/magento config:set admin/captcha/enable 0
bin/magento config:set admin/security/password_lifetime 0
bin/magento config:set admin/security/session_lifetime 31536000
bin/magento config:set admin/security/use_form_key 0
bin/magento config:set admin/url/custom ''
bin/magento config:set admin/url/use_custom 0
bin/magento config:set catalog/search/elasticsearch8_index_prefix <your value>
bin/magento config:set catalog/search/engine elasticsearch8
bin/magento config:set contact/email/recipient_email admin@mage2.pro
bin/magento config:set dev/css/merge_css_files 0
bin/magento config:set dev/css/minify_files 0
bin/magento config:set dev/image/default_adapter GD2
bin/magento config:set dev/js/enable_js_bundling 0
bin/magento config:set dev/js/merge_files 0
bin/magento config:set dev/js/minify_files 0
bin/magento config:set dev/static/sign 0
bin/magento config:set sales_email/creditmemo/copy_to ''
bin/magento config:set sales_email/creditmemo_comment/copy_to ''
bin/magento config:set sales_email/invoice/copy_to ''
bin/magento config:set sales_email/invoice_comment/copy_to ''
bin/magento config:set sales_email/order/copy_to ''
bin/magento config:set sales_email/order_comment/copy_to ''
bin/magento config:set sales_email/shipment/copy_to ''
bin/magento config:set sales_email/shipment_comment/copy_to ''
bin/magento config:set system/full_page_cache/caching_application 1
bin/magento config:set system/security/max_session_size_admin 9999999
bin/magento config:set system/security/max_session_size_storefront 9999999
bin/magento config:set trans_email/ident_custom1/email admin@mage2.pro
bin/magento config:set trans_email/ident_custom2/email admin@mage2.pro
bin/magento config:set trans_email/ident_general/email admin@mage2.pro
bin/magento config:set trans_email/ident_sales/email admin@mage2.pro
bin/magento config:set trans_email/ident_support/email admin@mage2.pro
bin/magento config:set web/cookie/cookie_domain ''
bin/magento config:set web/cookie/cookie_lifetime 9999999
bin/magento config:set web/cookie/cookie_path ''
bin/magento config:set web/secure/use_in_adminhtml 1
bin/magento config:set web/secure/use_in_frontend 1
bin/magento cache:clean

Step 10

Disable the 2-factor authentication for the backend

bin/magento module:disable Magento_AdminAdobeImsTwoFactorAuth
bin/magento module:disable Magento_TwoFactorAuth

Step 11

magento/adobe-stock-integration and magento/inventory-metapackage already included into Magento 2.4.7-p1, so you do not need to install them separately.

Step 12

UPDATE `sales_sequence_profile` SET suffix = '-DF2257';

Step 13

Switch Magento to the developer mode:

bin/magento deploy:mode:set developer

Step 14

Test the compilation:

rm -rf generated/*
bin/magento setup:di:compile

Step 15

Deploy the static content:

rm -rf pub/static/*
bin/magento setup:static-content:deploy -f

Step 16

bin/magento indexer:reindex

Step 17

bin/magento cron:run --bootstrap=standaloneProcessStarted=1
bin/magento cache:clean