# Run from source Elasticsearch and connect Kibana

**URL:** https://discuss.elastic.co/t/run-from-source-elasticsearch-and-connect-kibana/374279
**Category:** Kibana
**Tags:** elastic-stack-security, docker
**Created:** [February 9, 2025, 6:36pm UTC](https://discuss.elastic.co/t/run-from-source-elasticsearch-and-connect-kibana/374279 "2025-02-09T18:36:38Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Egor\_Krylovich](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/egor_krylovich/32/141245_2.png) [@Egor\_Krylovich](https://discuss.elastic.co/u/Egor_Krylovich)
#### Post date: [February 9, 2025, 6:36pm UTC](https://discuss.elastic.co/t/run-from-source-elasticsearch-and-connect-kibana/374279/1 "2025-02-09T18:36:38Z")

</div>

Hello,

I'm trying to setup environment for contribution into the project. I was able to run Elasticsearch from sources by running:

`./gradlew run`

I verified that the server is up and running by:  
`curl -u elastic:password "http://localhost:9200"`

Here is the response:

```auto
{
  "name" : "runTask-0",
  "cluster_name" : "runTask",
  "cluster_uuid" : "dJfGG-pNScCtiSYbVpat0g",
  "version" : {
    "number" : "9.1.0-SNAPSHOT",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "c59406723deef99b9f78aba1935a100465486ef0",
    "build_date" : "2025-02-07T19:58:50.087143Z",
    "build_snapshot" : true,
    "lucene_version" : "10.1.0",
    "minimum_wire_compatibility_version" : "8.19.0",
    "minimum_index_compatibility_version" : "8.0.0"
  },
  "tagline" : "You Know, for Search"
}

```

Then I run kibana inside docker container by

Then once I open Kibana in browser it asks enrollment tocken. But I don't see it in Elasticsearch logs.

I tried to use "Configure manually" button and put there `http://localhost:9200` but connection refused. Logs from Kibana:

`[ERROR][plugins.interactiveSetup.elasticsearch] Unable to connect to host "http://localhost:9200": connect ECONNREFUSED 127.0.0.1:9200`

When I tried to run:

`curl -u elastic:password "http://localhost:9200/_security/enroll/kibana"`

The response is:

`{"error":{"root_cause":[{"type":"security_exception","reason":"Enrollment mode is not enabled. Set [xpack.security.enrollment.enabled] to true, in order to use this API."}],"type":"security_exception","reason":"Enrollment mode is not enabled. Set [xpack.security.enrollment.enabled] to true, in order to use this API."},"status":403}`

Could someone support me on setting local dev env to have Elasticsearch run from source code and Kibana (may be there is better way other than from docker) connected to this local instance of Elasticsearch?

Really appreciate any help!

---

<div class="post-metadata">

### Author: ![RainTown](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/raintown/32/140206_2.png) [@RainTown](https://discuss.elastic.co/u/RainTown)
#### Post date: [February 9, 2025, 7:53pm UTC](https://discuss.elastic.co/t/run-from-source-elasticsearch-and-connect-kibana/374279/2 "2025-02-09T19:53:54Z")

</div>

Try this ….

> **[elasticsearch-create-enrollment-token | Elasticsearch Guide \[8.17\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/create-enrollment-token.html)**

---

<div class="post-metadata">

### Author: ![Egor\_Krylovich](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/egor_krylovich/32/141245_2.png) [@Egor\_Krylovich](https://discuss.elastic.co/u/Egor_Krylovich)
#### Post date: [February 10, 2025, 8:00am UTC](https://discuss.elastic.co/t/run-from-source-elasticsearch-and-connect-kibana/374279/3 "2025-02-10T08:00:57Z")

</div>

Good morning!

unfortunately I don't have bin directory as I run Elasticsearch not from distribution package but from source code. Also when I tried to make rest request to `http://localhost:9200/_security/enroll/kibana` it responds with `Enrollment mode is not enabled. Set [xpack.security.enrollment.enabled] to true, in order to use this API.`. So for me it looks like when I run locally from source some security options are disabled so Kibana should directly connect to Elasticsearch instance without enrollment token.  
Or most likely I'm missing something 🙂

---

<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: [February 10, 2025, 11:38am UTC](https://discuss.elastic.co/t/run-from-source-elasticsearch-and-connect-kibana/374279/4 "2025-02-10T11:38:33Z")

</div>

> [@Egor\_Krylovich](#):
>
> I tried to use "Configure manually" button and put there `http://localhost:9200` but connection refused. Logs from Kibana:
> 
> `[ERROR][plugins.interactiveSetup.elasticsearch] Unable to connect to host "http://localhost:9200": connect ECONNREFUSED 127.0.0.1:9200`

Using `localhost` means that Kibana will try to connect to a Elasticsearch instance running **on the same** server/container, which is not the case.

If your Elasticsearch is running in the host machine, you need to set the correct IP address in Kibana.

> [@Egor\_Krylovich](#):
>
> reason":"Enrollment mode is not enabled. Set [xpack.security.enrollment.enabled] to true, in order to use this API."

Did you set `xpack.security.enrollment.enabled` to `true` in `elasticsearch.yml` and restarted Elasticsearch?

---

<div class="post-metadata">

### Author: ![RainTown](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/raintown/32/140206_2.png) [@RainTown](https://discuss.elastic.co/u/RainTown)
#### Post date: [February 10, 2025, 1:47pm UTC](https://discuss.elastic.co/t/run-from-source-elasticsearch-and-connect-kibana/374279/5 "2025-02-10T13:47:51Z")

</div>

More for future reference, but do you have a elasticsearch-cli after building from source?

elasticsearch-create-enrollment-token is not that complex, just a bash script wrapper around elasticsearch-cli. And elasticsearch-cli is itself just a shell script that launches java with appropriate classes/libraries/settings.

But, in your original post you wrote:

> [@Egor\_Krylovich](#):
>
> Then I run kibana inside docker container by
> 
> Then once I open Kibana in browser it asks enrollment tocken

So you have elasticsearch running outside of docker, and kibana inside a docker container? So when you wrote:

> [@Egor\_Krylovich](#):
>
> `curl -u elastic:password "http://localhost:9200/_security/enroll/kibana"`

you were not executing this inside the kibana container, which is why you got a response.

Why not just download and run kibana on same host, directly, as with your source-built elasticsearch? At least without a little effort, your processes inside the container cannot talk to the processes on the host itself.

Also

> [@Egor\_Krylovich](#):
>
> ```auto
> "version" : {
> "number" : "9.1.0-SNAPSHOT"
> 
> ```

This is obviously ahead of the official releases of elasticsearch, so you might hit some issues when using the official kibana releases.

---

<div class="post-metadata">

### Author: ![Egor\_Krylovich](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/egor_krylovich/32/141245_2.png) [@Egor\_Krylovich](https://discuss.elastic.co/u/Egor_Krylovich)
#### Post date: [February 10, 2025, 7:10pm UTC](https://discuss.elastic.co/t/run-from-source-elasticsearch-and-connect-kibana/374279/6 "2025-02-10T19:10:54Z")

</div>

Yeah, it looks like one of main issues of connection refused was exactly that. I tried to put localhost for Kibana container, but it reference to container localhost and not my host machine.

To fix this issue I started to use instead of locahost 🙂

btw do you know where I can set xpack.security.enrollment.enabled property. Is it the right config that will be picked up by process run from sources:  
`distribution/src/config/elasticsearch.yml`  
?

Thank you

---

<div class="post-metadata">

### Author: ![Egor\_Krylovich](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/egor_krylovich/32/141245_2.png) [@Egor\_Krylovich](https://discuss.elastic.co/u/Egor_Krylovich)
#### Post date: [February 10, 2025, 7:14pm UTC](https://discuss.elastic.co/t/run-from-source-elasticsearch-and-connect-kibana/374279/7 "2025-02-10T19:14:59Z")

</div>

I didn't find elasticsearch-cli after building from source. The root cause of connection issue was exactly about localhost in docker container.  
Once I fixed it I populate the password for kibana\_system through API and it looks like it works except the fact that I'm running Elasticsearch from origin/main that contains 9.1.0-SNAPSHOT version of Elasticsearch. So now i'm receiving

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/0/b/0b76eac21dc8c0141a1ef636dfaf685637e3c6eb.png)

As you mentioned latest docker official kibana version doesn't support it. So i will try to change my branch to some lower (released) version of elasticsearch

Thank you

---

<div class="post-metadata">

### Author: ![RainTown](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/raintown/32/140206_2.png) [@RainTown](https://discuss.elastic.co/u/RainTown)
#### Post date: [February 10, 2025, 7:21pm UTC](https://discuss.elastic.co/t/run-from-source-elasticsearch-and-connect-kibana/374279/8 "2025-02-10T19:21:03Z")

</div>

As I said, the other elasticsearch-\* tools are just shell wrappers of different java calls. You can download a tar file and look at them. (I have no idea if they are differently licensed)

You can close this thread by accepting one of the answers.

Good luck with your project.
