There is currently no way to change the GRPC port early in the process to get the Fleet Server bootstrap process to use a different port. This is because the install command will not read the elastic-agent.yml contents in that stage.
Best solution is to stop the process running on the :6789 port and install the Elastic Agent with Fleet Server. Then stop the Elastic Agent, modify the port in the elastic-agent.yml file, then start the Elastic Agent.
Then you can turn on the other process that was using the :6789 port.