# Elastic agent uninstall

**URL:** <https://discuss.elastic.co/t/elastic-agent-uninstall/349659>\
**Category:** Elastic Agent\
**Created:** [December 19, 2023, 2:19pm UTC](https://discuss.elastic.co/t/elastic-agent-uninstall/349659 "2023-12-19T14:19:56Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![secsec](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@secsec](https://discuss.elastic.co/u/secsec)\
**Post date:** [December 19, 2023, 3:01pm UTC](https://discuss.elastic.co/t/elastic-agent-uninstall/349659/5 "2023-12-19T15:01:05Z")

</div>

I did this and now it is enrolled, topic can be closed

rm /etc/systemd/system/elastic-agent.service  
root@elk:/opt/Elastic# rm -r Agent

```
curl -L -O https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-8.11.2-linux-x86_64.tar.gz

```

tar xzvf elastic-agent-8.11.2-linux-x86\_64.tar.gz  
cd elastic-agent-8.11.2-linux-x86\_64  
sudo ./elastic-agent install --url=https://:8220   
--fleet-server-es=[https://localhost:9200](https://localhost:9200)   
--fleet-server-service-token=   
--fleet-server-policy=fleet-server-policy   
--certificate-authorities=/etc/elasticsearch/certs/new/ca.pem   
--fleet-server-es-ca=/etc/elasticsearch/certs/new/ca.pem   
--fleet-server-cert=/etc/elasticsearch/certs/new/elasticsearch.crt   
--fleet-server-cert-key=/etc/elasticsearch/certs/new/elasticsearch.key   
--fleet-server-port=8220

thanks

---

_[View the full topic](https://discuss.elastic.co/t/elastic-agent-uninstall/349659)._
