# Curl -X GET Command Error

**URL:** <https://discuss.elastic.co/t/curl-x-get-command-error/362035>\
**Category:** Elasticsearch\
**Created:** [June 25, 2024, 3:27pm UTC](https://discuss.elastic.co/t/curl-x-get-command-error/362035 "2024-06-25T15:27:18Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![dfir](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@dfir](https://discuss.elastic.co/u/dfir)\
**Post date:** [June 25, 2024, 3:27pm UTC](https://discuss.elastic.co/t/curl-x-get-command-error/362035/1 "2024-06-25T15:27:18Z")

</div>

I am trying to install Elasticsearch on Ubuntu. When I run curl -X GET '[http://localhost:9200](http://localhost:9200) I get an error: Empty Reply from Server.

I get this when the firewall is disabled and also when it is enabled.

I have adjusted the elasticsearch yml to uncomment port 9200 and also localhost

I have enabled allowed access to port 9200 but still get this error.

Anyone have any ideas?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [June 25, 2024, 3:32pm UTC](https://discuss.elastic.co/t/curl-x-get-command-error/362035/2 "2024-06-25T15:32:59Z")

</div>

Have you tried https instead of http?

---

<div class="post-metadata">

**Author:** ![dfir](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@dfir](https://discuss.elastic.co/u/dfir)\
**Post date:** [June 25, 2024, 3:38pm UTC](https://discuss.elastic.co/t/curl-x-get-command-error/362035/3 "2024-06-25T15:38:14Z")

</div>

Yes. When I do that I get a different error:

SSL Certificate Problem.

Also my Elasticsearch log shows that I cannot run it as root. I dont re-call trying to run elastic at all, I am at this point just trying to install it.

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [June 25, 2024, 3:54pm UTC](https://discuss.elastic.co/t/curl-x-get-command-error/362035/4 "2024-06-25T15:54:56Z")

</div>

> [@dfir](#):
>
> Yes. When I do that I get a different error:
> 
> SSL Certificate Problem.

Which curl command you used and what is the response?

You need to pass the ca of your cluster using the `cacert` option or tell curl to ignore it using the `-k` option.

---

<div class="post-metadata">

**Author:** ![dfir](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@dfir](https://discuss.elastic.co/u/dfir)\
**Post date:** [June 25, 2024, 4:09pm UTC](https://discuss.elastic.co/t/curl-x-get-command-error/362035/5 "2024-06-25T16:09:55Z")

</div>

Command: curl -X GET [https://localhost:9200](https://localhost:9200)

Error: curl: (60) SSL Certificate problem: self-signed certificate in certificate chain.

Curl failed to verify the legitimacy of the server and therefore could not establish a secure connection to it.

Just so you know these are the only commands ive run so far:

curl -fsSL [https://artifacts.elastic.co/GPG-KEY-elasticsearch](https://artifacts.elastic.co/GPG-KEY-elasticsearch) |sudo gpg --dearmor -o /usr/share/keyrings/elastic.gpg

echo "deb [signed-by=/usr/share/keyrings/elastic.gpg] [https://artifacts.elastic.co/packages/8.x/apt](https://artifacts.elastic.co/packages/8.x/apt) stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list

sudo apt update

sudo apt install elasticsearch

sudo nano /etc/elasticsearch/elasticsearch.yml - to uncomment network host and port

sudo systemctl start elasticsearch

sudo systemctl enable elasticsearch

curl -X GET "localhost:9200"

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [June 25, 2024, 4:13pm UTC](https://discuss.elastic.co/t/curl-x-get-command-error/362035/6 "2024-06-25T16:13:03Z")

</div>

What version (I am assukming 8.14) and how did you install.... looks like `.deb`

If you follow the official documentation, there is. a section on how to properly check if elasticsearch is runing [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html#deb-check-running)

BTW here are the official install instructions [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html#deb-repo)

One of your commands is incorrect.....

```auto
echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-8.x.list

```

```auto
.../etc/apt/sources.list.d/elastic-8.x.list
...................................^

```

---

<div class="post-metadata">

**Author:** ![dfir](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@dfir](https://discuss.elastic.co/u/dfir)\
**Post date:** [June 25, 2024, 4:27pm UTC](https://discuss.elastic.co/t/curl-x-get-command-error/362035/7 "2024-06-25T16:27:44Z")

</div>

That was a copy / paste error. I ran that 2nd command with version 8.x, I just copied it into this chat from the original source incorrectly.

This command: curl --cacert /etc/elasticsearch/certs/http\_ca.crt -u elastic:$ELASTIC\_PASSWORD [https://localhost:9200](https://localhost:9200)

Generates an error: curl: (77) error setting certificate file: /etc/elasticsearch/certs/http\_ca.crt

---

<div class="post-metadata">

**Author:** ![dfir](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@dfir](https://discuss.elastic.co/u/dfir)\
**Post date:** [June 25, 2024, 4:42pm UTC](https://discuss.elastic.co/t/curl-x-get-command-error/362035/8 "2024-06-25T16:42:51Z")

</div>

I'm ripping everything out and starting fresh. I've been in IT for 20 years and installing Elastic is the most frustrating installation ive ever done.

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [June 25, 2024, 4:49pm UTC](https://discuss.elastic.co/t/curl-x-get-command-error/362035/9 "2024-06-25T16:49:49Z")

</div>

Hi @dfir, apologies for the frustration...

If you install elasticsearch with all the defaults it will be secured with TLS on all ports and require authentication.

Thus curl will require https , a CA (because a self signed cert is generated) and authentication

The proper install procedure is here including how to test / check if running properly.

> **[Install Elasticsearch with Debian Package | Elasticsearch Guide \[8.14\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html)**

If you are cleaning / reinstalling make sure to clean up the data directories default `/var/lib/elasticsearch` if you don't there will be leftovers... that will interfere with your re-install...
