Unable to install on Ubuntu 22

How do you install a simple configuration on Ubuntu 22?

I ran:

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
sudo sh -c 'echo "deb https://artifacts.elastic.co/packages/8.x/apt stable main" > /etc/apt/sources.list.d/elastic-8.x.list'
sudo apt-get update
sudo apt install elasticsearch
sudo systemctl daemon-reload
sudo systemctl enable elasticsearch.service
sudo systemctl start elasticsearch.service

It starts up just fine, but attempting to do:

curl -X GET "localhost:9200"

just fails with the error:

curl: (52) Empty reply from server

I've researched the error and tried all the obvious fixes. My ufw firewall is off. I set network.host=localhost. I set http.host: 0.0.0.0. I set discovery.type: single-node and disabled cluster.initial_master_nodes. But none of those had any effect.

I tried disabling xpack.security.http.ssl and xpack.security.transport.ssl, but that made curl respond, but with the JSON error:

{"error":{"root_cause":[{"type":"security_exception","reason":"missing authentication credentials for REST request [/]","header":{"WWW-Authenticate":["Basic realm=\"security\", charset=\"UTF-8\"","ApiKey"]}}],"type":"security_exception","reason":"missing authentication credentials for REST request [/]","header":{"WWW-Authenticate":["Basic realm=\"security\", charset=\"UTF-8\"","ApiKey"]}},"status":401}

so I re-enabled ssl.

What am I missing? How do you configure Elasticsearch to run as a simple single node on Ubuntu?

Hello,

Could you please use -

curl -X elastic:password http://localhost:9200

Password which was generated automatically while installing the elasticsearch.

Thanks!

Instead you could use https instead of http in your curl request:

curl -k -u elastic "https://localhost:9200"

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.