Skip to content

issues when installing magento 2.4.6 on WSL2 ubuntu 22.04

Ok, let’s move on. I am new to this and I am trying to install magento 2.4.6 on a local WSL server with Ubuntu 22.04, I have apache2, php8.1 and 8.2, composer, mysql and elasticsearch 8 installed.

I have 2 problems:

  1. I installed Magento and I don’t know how to access either the home or the admin, following several guides, this is the installation command I used:
bin/magento setup:install  --disable-modules=Magento_InventoryElasticsearch,Magento_Elasticsearch8,Magento_Elasticsearch,Magento_OpenSearch 
--base-url=http://local.core.com 
--db-host=localhost 
--db-name=magento 
--db-user=admin 
--db-password=admin 
--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

i added this:

    ::1             localhost
    ::1             http://local.core.com

to the windows host file and it only returns the error: ERR_NAME_NOT_RESOLVED

  1. After the installation I couldn’t get Magento to take elasticsearch following the guide on the official website and this other question when using this command:

curl --cacert /etc/elasticsearch/certs/http_ca.crt -u elastic:$ELASTIC_PASSWORD https://localhost:9200

the answer is this:

{
  "name" : "Aksonyn-PC",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "Vbm4-RXURbi0rk5NtKaNmQ",
  "version" : {
    "number" : "8.10.4",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "b4a62ac808e886ff032700c391f45f1408b2538c",
    "build_date" : "2023-10-11T22:04:35.506990650Z",
    "build_snapshot" : false,
    "lucene_version" : "9.7.0",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"
}

but when executing the command php bin/magento setup:upgrade it gives me the following error: Could not validate a connection to Elasticsearch. No alive nodes. All the 1 nodes seem to be down.