How to install Magento 2.4
-
14-04-2021 - |
Вопрос
I try install fresh magento 2.4 but always available setup wizard but currently I not see setup wizard in this version.
How to install magento 2.4 ?
Решение
Example of CLI command install :
php bin/magento setup:install --base-url="http://yourdomaine.com/" --base-url-secure="http://yourdomaine.com/" --backend-frontname="admin" --session-save="files" --db-host="localhost" --db-name="your-db-name" --db-user="your-db-user" --db-password="your-db-password" --admin-firstname="Your_first_name" --admin-lastname="Your_last_name" --admin-email="name@domaine.com" --admin-user="username" --admin-password="SomeStrongPasswordHere" --language=en_US --currency=USD --timezone=America/Chicago --use-rewrites=1 --search-engine=elasticsearch7 --elasticsearch-host="localhost" --elasticsearch-port=9200
If you ever encounter bellow error, you can follow this answer.
In SearchConfig.php line 81: Could not validate a connection to Elasticsearch. No alive nodes found in your cluster
For more information, Magento DevDocs: Install the Magento 2.4 software
Другие советы
if you want to install version using CLI these are basic steps you should follow. check if elastic server is installed, using :
**curl elastic-server-ip:port** //example -> curl localhost:9200
it will output server info if started otherwise start the server
afte this, download Magento2.4 using composer
mkdir DIRECTORY_NAME_WHERE_YOU_WANT_TO_INSTALL
cd DIRECTORY_NAME_WHERE_YOU_WANT_TO_INSTALL
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition:2.4.0 .
after downloading Magento now use below command to install it
php bin/magento setup:install --base-url=http://your-host/m2.4/ \
--db-host=db-host --db-name=db-name --db-user=db-user --db-password=db-password \
--admin-firstname=Magento --admin-lastname=User --admin-email=user@example.com \
--admin-user=admin --admin-password=admin123 --language=en_US \
--currency=USD --timezone=America/Chicago --use-rewrites=1 \
--search-engine=elasticsearch7 --elasticsearch-host=elastic-host \
--elasticsearch-port=elastic-port --backend-frontname=admin
now your magento is ready for development
follow below steps for magento v2.4.1 installation
step-1) setup(install) Elasticsearch and run.
Note: if you are using windows: Find validateURLScheme function in vendor\magento\framework\Image\Adapter\Gd2.php file. at line 86. Replace function with this:
private function validateURLScheme(string $filename) : bool { $allowed_schemes = ['ftp', 'ftps', 'http', 'https']; $url = parse_url($filename); if ($url && isset($url['scheme']) && !in_array($url['scheme'], $allowed_schemes) && !file_exists($filename)) { return false; }
return true;
}
step-2)
php bin/magento setup:install --base-url="http://domain.com/" --base-url-secure="https://domain.com/" --backend-frontname="admin" --session-save="files" --db-host="localhost" --db-name="database name" --db-user="database user" --db-password="database password" --admin-firstname="Admin firstname(Anjani)" --admin-lastname="Admin lastname(choubey)" --admin-email="email I'd(abc@gmail.com)" --admin-user="admin username" --admin-password="admin password" --language=en_US --currency=USD --timezone=America/Chicago --use-rewrites=1 --search-engine=elasticsearch7 --elasticsearch-host="localhost" --elasticsearch-port=9200
step-3) After Run above command successful run the below command php bin/magento indexer:reindex
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f
php bin/magento cache:clean
php bin/magento cache:flush
Note: if you are using windows:
Change Symlink to copy in file di.xml Find file Validator.php in ...Magento\Framework\View\Element\Template\File At around line 138 replace code with this one
$realPath = str_replace('\', '/',$this-fileDriver-getRealPath($path));
Run : php bin/magento cache:flush
Step-4) Disable The Two Factor Auth
php bin/magento module:disable Magento_TwoFactorAuth
Now you can run and test the website
Frontend Url= http://domain.com/
backend Url= http://domain.com/admin
For Magento 2.4 installation, First, we need to set up an elastic search on your server. Because Magento added new featured on the catalog search. after you need to add an installation command on the terminal.
For more information, Install Magento 2.4