# Apm-server SystemD unit file?

**URL:** <https://discuss.elastic.co/t/apm-server-systemd-unit-file/130403>\
**Category:** APM\
**Created:** [May 3, 2018, 8:50am UTC](https://discuss.elastic.co/t/apm-server-systemd-unit-file/130403 "2018-05-03T08:50:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![A\_B](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/a_b/32/17104_2.png) [@A\_B](https://discuss.elastic.co/u/A_B)\
**Post date:** [May 3, 2018, 8:50am UTC](https://discuss.elastic.co/t/apm-server-systemd-unit-file/130403/1 "2018-05-03T08:50:17Z")

</div>

Hello all,

has anyone tried to create a `apm-server` SystemD unit file? I'm working on a puppet manifest to install `apm-server` and would like to manage the service using SystemD.

Cheers,  
AB

---

<div class="post-metadata">

**Author:** ![A\_B](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/a_b/32/17104_2.png) [@A\_B](https://discuss.elastic.co/u/A_B)\
**Post date:** [May 3, 2018, 1:02pm UTC](https://discuss.elastic.co/t/apm-server-systemd-unit-file/130403/2 "2018-05-03T13:02:04Z")

</div>

I copied the Elasticsearch unit file and made a few changes. Seems to be running ok 🙂

---

<div class="post-metadata">

**Author:** ![gil](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gil/32/41911_2.png) [@gil](https://discuss.elastic.co/u/gil)\
**Post date:** [May 4, 2018, 3:02pm UTC](https://discuss.elastic.co/t/apm-server-systemd-unit-file/130403/3 "2018-05-04T15:02:35Z")

</div>

@A_B glad to hear it. This is what ends up packaged with apm-server:

```auto
[Unit]
Description=apm-server
Documentation=https://www.elastic.co/guide/en/apm/server/
Wants=network-online.target
After=network-online.target

[Service]
ExecStart=/usr/share/apm-server/bin/apm-server -c /etc/apm-server/apm-server.yml -path.home /usr/share/apm-server -path.config /etc/apm-server -path.data /var/lib/apm-server -path.logs /var/log/apm-server
Restart=always

[Install]
WantedBy=multi-user.target

```

Please let us know if you have improvements that you'd like to contribute back!

---

<div class="post-metadata">

**Author:** ![A\_B](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/a_b/32/17104_2.png) [@A\_B](https://discuss.elastic.co/u/A_B)\
**Post date:** [May 4, 2018, 3:24pm UTC](https://discuss.elastic.co/t/apm-server-systemd-unit-file/130403/4 "2018-05-04T15:24:36Z")

</div>

Thanks @gil,

I couldn't find one after installing the Debian package so that's why I made my own.

Should `apm-server` always run as user `root` or does it matter?

Cheers,  
AB

---

<div class="post-metadata">

**Author:** ![gil](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gil/32/41911_2.png) [@gil](https://discuss.elastic.co/u/gil)\
**Post date:** [May 4, 2018, 3:47pm UTC](https://discuss.elastic.co/t/apm-server-systemd-unit-file/130403/5 "2018-05-04T15:47:08Z")

</div>

It's generated at packaging time so it's a bit hard to find [here](https://github.com/elastic/apm-server/blob/6.3/_beats/dev-tools/packer/platforms/debian/systemd.j2). There's no need to run as root - as long as it's able to open the listener, write logs, read the conf, etc you should be good to go. Good luck!

---

<div class="post-metadata">

**Author:** ![A\_B](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/a_b/32/17104_2.png) [@A\_B](https://discuss.elastic.co/u/A_B)\
**Post date:** [May 7, 2018, 11:38am UTC](https://discuss.elastic.co/t/apm-server-systemd-unit-file/130403/6 "2018-05-07T11:38:39Z")

</div>

Cool, thank you very much for the info @gil !

---

<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:** [May 28, 2018, 7:38am UTC](https://discuss.elastic.co/t/apm-server-systemd-unit-file/130403/7 "2018-05-28T07:38:39Z")

</div>

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