# Need help with Elastic agent installation

**URL:** <https://discuss.elastic.co/t/need-help-with-elastic-agent-installation/338570>\
**Category:** Elastic Agent\
**Tags:** fleet\
**Created:** [July 17, 2023, 1:51pm UTC](https://discuss.elastic.co/t/need-help-with-elastic-agent-installation/338570 "2023-07-17T13:51:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Retrogamer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/retrogamer/32/123537_2.png) [@Retrogamer](https://discuss.elastic.co/u/Retrogamer)\
**Post date:** [July 17, 2023, 1:51pm UTC](https://discuss.elastic.co/t/need-help-with-elastic-agent-installation/338570/1 "2023-07-17T13:51:12Z")

</div>

It has been a few days that I am going through all documentations to install Elastic-agent either with Fleet Server or Stand-alone, but still, I have not been able to understand how each components works, what is the precise step-by-step method etc. So below, I describe my environment and errors I have got, please tell me what I am doing wrong.

On a Ubuntu 22.04.2 LTS, Elastic Search and Kibana 8.8.1 on Docker - both listening on port 9200, 5601 respectively. I enroll Kibana and successfully login.

Kibana \> Management \> Fleet \> Add Fleet Server

```auto
sudo ./elastic-agent install \
  --fleet-server-es=https://172.19.0.2:9200 \
  --fleet-server-service-token=some_hash\
  --fleet-server-policy=fleet-server-policy \
  --fleet-server-es-ca-trusted-fingerprint=some_hash \
  --fleet-server-port=8220

```

Agent get installed at /opt/Elastic/Agent and will run as a service and then: Successfully enrolled the Elastic Agent. Elastic Agent has been successfully installed.

After, on Kibana, Fleet Server Connected, Continue enrolling Elastic agent. Clicking Contine -\> Enroll in Fleet -\> Agent policy 1 -\> Create. Then I should run:

```auto
sudo ./elastic-agent install --url=https://172.18.0.2:9200 --enrollment-token=some_hash
Error: already installed at: /opt/Elastic/Agent

```

And if I use enroll:

```auto
Error: fail to enroll: fail to execute request to fleet-server: dial tcp 172.18.0.2:9200: connect: connection refused

```

And if enroll as --insecure

```auto
"message":"SSL/TLS verifications disabled.","ecs.version":"1.6.0"}
Error: fail to enroll: fail to execute request to fleet-server: dial tcp 172.18.0.2:9200: connect: connection refused

```

What I am doing wrong?

Meanwhile, once Adding Fleet Server, the Agent get installed. Then why should I enroll an agent again in the next step with install command?  
Also, if I want to use Agent as Stand-alone, I get to same dead-end.

Can you please direct me to step-by-step instruction to implement Stand-alone agent using Docker Image 8.8.1 or using TAR/RPM package?

---

<div class="post-metadata">

**Author:** ![blaker](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/blaker/32/65621_2.png) [@blaker](https://discuss.elastic.co/u/blaker)\
**Post date:** [July 17, 2023, 1:57pm UTC](https://discuss.elastic.co/t/need-help-with-elastic-agent-installation/338570/2 "2023-07-17T13:57:35Z")

</div>

If you have enrolled the Elastic Agent on that host with a Fleet Server you do not need to enroll that host again with another Elastic Agent. The Elastic Agent is already runing.

The UI is highlighting that once your have a Fleet Server/Elastic Agent that you will want to add another host to enroll into that Fleet Server.

Being that you are enrolling a Fleet Server you would be better off to not use standalone mode, and instead enroll Elastic Agents into the Fleet Server. This shows how to enroll an Elastic Agent into that Fleet Server your enrolled. [Run Elastic Agent in a container | Fleet and Elastic Agent Guide [8.8] | Elastic](https://www.elastic.co/guide/en/fleet/current/elastic-agent-container.html#_step_4_run_the_elastic_agent_image)

---

<div class="post-metadata">

**Author:** ![Retrogamer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/retrogamer/32/123537_2.png) [@Retrogamer](https://discuss.elastic.co/u/Retrogamer)\
**Post date:** [July 17, 2023, 2:13pm UTC](https://discuss.elastic.co/t/need-help-with-elastic-agent-installation/338570/3 "2023-07-17T14:13:52Z")

</div>

Thanks. So it is okay to use Fleet Server policy for Integrations - especially in Production env?  
I have actually done it and worked (in my case Postgres). just want to know if this is the right practice or I should create new policy and add Agent to it?  
And if this is the case, then again, I will get the enrollment errors stated above. What should I do? Do I need to use another host?

---

<div class="post-metadata">

**Author:** ![blaker](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/blaker/32/65621_2.png) [@blaker](https://discuss.elastic.co/u/blaker)\
**Post date:** [July 17, 2023, 2:25pm UTC](https://discuss.elastic.co/t/need-help-with-elastic-agent-installation/338570/4 "2023-07-17T14:25:27Z")

</div>

It is completely acceptable to use that Elastic Agent for integrations. You should only have 1 Elastic Agent per host.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 14, 2023, 2:25pm UTC](https://discuss.elastic.co/t/need-help-with-elastic-agent-installation/338570/5 "2023-08-14T14:25:31Z")

</div>

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