# Unable to change the elastic-agent grpc.port during fleet server setup

**URL:** <https://discuss.elastic.co/t/unable-to-change-the-elastic-agent-grpc-port-during-fleet-server-setup/286314>\
**Category:** Elastic Security\
**Tags:** fleet\
**Created:** [October 10, 2021, 6:14pm UTC](https://discuss.elastic.co/t/unable-to-change-the-elastic-agent-grpc-port-during-fleet-server-setup/286314 "2021-10-10T18:14:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rrivers](https://avatars.discourse-cdn.com/v4/letter/r/8c91f0/32.png) [@rrivers](https://discuss.elastic.co/u/rrivers)\
**Post date:** [October 10, 2021, 6:14pm UTC](https://discuss.elastic.co/t/unable-to-change-the-elastic-agent-grpc-port-during-fleet-server-setup/286314/1 "2021-10-10T18:14:21Z")

</div>

I'm trying to install fleet server 7.15 on an Ubuntu 20.04 machine but I'm running into a port conflict since 127.0.0.1:6789 is already in use by another application. I found a post that suggested running  
`./elastic-agent -c elastic-agent.yml -e`  
which showed:  
`Error: listen tcp 127.0.0.1:6789: bind: address already in use`

I searched elastic-agent.yml and found the port number 6789 in the config file. I removed the comments from that section and changed the port number to 6788:

```auto
agent.grpc:
  # listen address for the GRPC server that spawned processes connect back to.
  address: localhost
  # port for the GRPC server that spawned processes connect back to.
  port: 6788

```

Running the command again showed the same message. Searching google I found the follow topic with a similar issue on 7.10:  
[https://discuss.elastic.co/t/failed-to-cleanup-run-elastic-agent-sock/259809](https://discuss.elastic.co/t/failed-to-cleanup-run-elastic-agent-sock/259809)  
I copied the three lines from that post into my config file and ran the same command but that too was ignored. Finally I tried moving the lines to the top of the config file but that also failed. Has anyone else been able to change the port with version 7.15? If it makes any difference I'm using the linux .tar.gz version of elastic-agent.

---

<div class="post-metadata">

**Author:** ![Michal\_Pristas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michal_pristas/32/46639_2.png) [@Michal\_Pristas](https://discuss.elastic.co/u/Michal_Pristas)\
**Post date:** [October 11, 2021, 12:54pm UTC](https://discuss.elastic.co/t/unable-to-change-the-elastic-agent-grpc-port-during-fleet-server-setup/286314/2 "2021-10-11T12:54:08Z")

</div>

instead of `elastic-agent.yml` try modifying `fleet.yml` on a same path.  
adding `agent.grpc.port: 6788` should be enough

---

<div class="post-metadata">

**Author:** ![rrivers](https://avatars.discourse-cdn.com/v4/letter/r/8c91f0/32.png) [@rrivers](https://discuss.elastic.co/u/rrivers)\
**Post date:** [October 11, 2021, 2:19pm UTC](https://discuss.elastic.co/t/unable-to-change-the-elastic-agent-grpc-port-during-fleet-server-setup/286314/3 "2021-10-11T14:19:46Z")

</div>

Thanks Michal! That worked right away and now I can run the command above to start the agent, metric beat and file beat start. Should the entries for agent.grpc be moved from elastic-agent.yml to fleet.yml or the documentation be updated?

On to the next problem, where installing fleet server returns an error indicating that it can't find the unix socket. I will troubleshoot that when I get a chance.

---

<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:** [November 8, 2021, 2:20pm UTC](https://discuss.elastic.co/t/unable-to-change-the-elastic-agent-grpc-port-during-fleet-server-setup/286314/4 "2021-11-08T14:20:41Z")

</div>

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