Magento 2.4 Catalog Search Engine Requirement
As of Magento 2.4, all installations must be configured to use Elasticsearch as the catalog search solution. Elasticsearch provides the following benefits:
You must install and configure Elasticsearch 7.6.x before upgrading to Magento 2.4.x.Magento 2.4.x is tested with Elasticsearch 7.6.x only. You can use other 7.x versions at your discretion, but we recommend using the tested version of Elasticsearch. Magento does not support Elasticsearch 2.x, 5.x, and 6.x.
Import Note: We have been able to use Magento 2.4 locally using ElasticSearch 6.8 and this documentation is based on that ElasticSearch version. At the time of writing this we are not able to install a version higher than 6.8
Valet Plus Comes with Elasticsearch by default . To configure Elasticsearch you have to do some customization. See Below :
Run the commands below to open up your Elastic Search configuration in nano. You can use another editor like Vim or Atom if you like.
sudo nano /usr/local/etc/nginx/valet/elasticsearch.conf
Add the configurations below to your file.
server {
listen 80;
server_name elasticsearch.test www.elasticsearch.test;
charset utf-8;
client_max_body_size 128M;
location / {
chunked_transfer_encoding on;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_redirect off;
proxy_buffering off;
proxy_pass http://localhost:9200;
}
}
To Install the latest version of ElasticSearch follow the instructions below:
brew uninstall [email protected]< existing/older version>
valet elasticsearch install
The second command installs the latest version of Elasticsearch available from brew.
If for some reason “valet elasticsearch install” it throws an exception. Please run the following :
valet use es 6.8
Install php 7.4 if needed running the command below :
valet use 7.4 && valet restart
For testing , use this documentation.
Create a file at the path ~/.valet/Nginx/all.conf
Add the configurations below inside it
proxy_buffer_size 4096k;
proxy_buffers 128 4096k;
proxy_busy_buffers_size 4096k;
Append the text below to /usr/local/etc/nginx/fastcgi_params
fastcgi_buffer_size 4096k;
fastcgi_buffers 128 4096k;
fastcgi_busy_buffers_size 4096k;
Restart Valet Plus
valet restart
Download Magento 2.4 from Composer or using this link.
After Downloading it extract the file in your Valet Parked Directory rename the directory to “magento-24”
Magento 2.4 doesn’t support a GUI installation so you have to run the command below in the root directory.
php bin/magento setup:install --base-url=http://magento-24.test/ \--db-host=localhost --db-name=MagentoDB --db-user=root --db-password=root \--language=en_US --currency=USD --timezone=America/Chicago --use-rewrites=1 \--search-engine=elasticsearch7 --elasticsearch-host=127.0.0.1 \
--elasticsearch-port=9200
If you want to configure your admin credentials in the same step use the command below :
php bin/magento setup:install --base-url=http://magento-24.test/ \--db-host=localhost --db-name= MagentoDB --db-user=root --db-password=root\--admin-firstname=Magento --admin-lastname=User [email protected] \--admin-user=admin --admin-password=admin123 --language=en_US \--currency=USD --timezone=America/Chicago --use-rewrites=1 \--search-engine=elasticsearch7 --elasticsearch-host=127.0.0.1\--elasticsearch-port=9200
After running this command you should see a message similar to the following display to indicate a successful installation:
Post installation file permissions check...
For security, remove write permissions from these directories: '/var/www/html/magento2/app/etc'
[Progress: 274 / 274]
[SUCCESS]: Magento installation complete.
[SUCCESS]: Admin Panel URI: /admin_puu71q
Your storefront URL is http://magento-24.test
The database server is on the same host as the web server.
The database name is magento, and the username and password are both magento.
Uses server rewrites.
First and last name are Magento User.
Username is admin and the password is admin123.
E-mail address is [email protected]
Default language is en_US (U.S. English).
Default currency is U.S. dollars.
Default time zone is U.S. Central (America/Chicago).
Elasticsearch 7 is installed on es-host.example.com and connects on port 9200.[/vc_column_text][/vc_column][/vc_row]