# Manual Installation: Systemd Service File

**URL:** <https://community.cratedb.com/t/manual-installation-systemd-service-file/690>\
**Category:** CrateDB\
**Created:** [May 26, 2021, 11:22pm UTC](https://community.cratedb.com/t/manual-installation-systemd-service-file/690 "2021-05-26T23:22:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![inviridi](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/inviridi/32/273_2.png) [@inviridi](https://community.cratedb.com/u/inviridi)\
**Post date:** [May 26, 2021, 11:22pm UTC](https://community.cratedb.com/t/manual-installation-systemd-service-file/690/1 "2021-05-26T23:22:56Z")

</div>

Continuing the discussion from [Installation on OpenSuse fails](https://community.cratedb.com/t/installation-on-opensuse-fails/615/4):

Hi crate users,

unpacking the tarball for “installation” has flawlessly worked on the three systems I tested it on. Now I would like to automatically start crate at boot time and tried to build a systemd service file. It is very short – just like the error it fails with.

```
[Unit]
Description=Crate DB

[Service]
Type=forking
WorkingDirectory=/home/fl/SW/crate
ExecStart=/home/fl/SW/crate/bin/crate -d
KillSignal=SIGTERM
Restart=always
RestartSec=5s

[Install]
WantedBy=multi-user.target

```

The error I get is:

```
May 27 01:06:21 tuxedo systemd[1]: Started Crate DB (electricity monitoring)..
May 27 01:06:22 tuxedo systemd[1]: cratedb.service: Main process exited, code=exited, status=1/FAILURE
May 27 01:06:22 tuxedo systemd[1]: cratedb.service: Unit entered failed state.
May 27 01:06:22 tuxedo systemd[1]: cratedb.service: Failed with result 'exit-code'.

```

I tried a few things, none of which worked. Would one of you mind sharing their systemd.service file with the community? I guess it would be helpful to have a template in the tarball already tor simple adaptation…

In any case: Thanks a lot for your help!

Cheers,  
Frank

---

<div class="post-metadata">

**Author:** ![proddata](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/proddata/32/1379_2.png) [@proddata](https://community.cratedb.com/u/proddata)\
**Post date:** [June 1, 2021, 9:15am UTC](https://community.cratedb.com/t/manual-installation-systemd-service-file/690/2 "2021-06-01T09:15:26Z")

</div>

Here the copy included with the Ubuntu distro. Might help as starting point:

> /lib/systemd/system/crate.service

```auto
[Unit]
Description=CrateDB Server
Documentation=https://crate.io/docs/
Wants=network.target
After=network.target

[Service]
Type=simple
User=crate
Group=crate
WorkingDirectory=/usr/share/crate

# default environment variables
Environment="CRATE_HOME=/usr/share/crate"
Environment="CRATE_PATH_CONF=/etc/crate"
Environment="CRATE_PATH_LOG=/var/log/crate"
Environment="CRATE_GC_LOG_DIR=/var/log/crate"
Environment="CRATE_HEAP_DUMP_PATH=/var/lib/crate"
# load environment
EnvironmentFile=-/etc/default/crate

ExecStart=/usr/share/crate/bin/crate \
    -Cpath.conf=${CRATE_PATH_CONF} \
    -Cpath.logs=${CRATE_PATH_LOG}

StandardOutput=journal
StandardError=journal

# Disable timeout logic and wait until process is stopped
TimeoutStopSec=0

# SIGTERM signal is used to stop the Java process
KillSignal=SIGTERM

# Send the signal only to the JVM rather than its control group
KillMode=process

# Java process is never killed
SendSIGKILL=no

# When a JVM receives a SIGTERM signal it exits with code 143
SuccessExitStatus=143 SIGTERM SIGKILL

# Override these settings with a file called
# /etc/systemd/system/crate.service.d/crate.conf and specify any changes

# Specifies the maximum number of bytes of memory that may be locked into RAM
LimitMEMLOCK=infinity

# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=65536

# Specifies the maximum number of processes
LimitNPROC=4096

# Specifies limit of virtual memory that can be used
LimitAS=infinity

[Install]
WantedBy=multi-user.target

```

---

<div class="post-metadata">

**Author:** ![inviridi](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/inviridi/32/273_2.png) [@inviridi](https://community.cratedb.com/u/inviridi)\
**Post date:** [June 2, 2021, 3:06pm UTC](https://community.cratedb.com/t/manual-installation-systemd-service-file/690/3 "2021-06-02T15:06:22Z")

</div>

Funny, how things start functioning once you use them correctly. I adapted and simplified the file a bit and it works like a treat. Thanks for sharing @proddata!

---

<div class="post-metadata">

**Author:** ![proddata](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/proddata/32/1379_2.png) [@proddata](https://community.cratedb.com/u/proddata)\
**Post date:** [June 2, 2021, 3:16pm UTC](https://community.cratedb.com/t/manual-installation-systemd-service-file/690/4 "2021-06-02T15:16:24Z")

</div>

Great 🙂

Would be cool if you could share your setup steps on OpenSuse e.g. in short tutorial [Tutorials - Crate.io Community](https://community.cratedb.com/c/tutorials/28)

---

<div class="post-metadata">

**Author:** ![inviridi](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/inviridi/32/273_2.png) [@inviridi](https://community.cratedb.com/u/inviridi)\
**Post date:** [June 4, 2021, 9:03pm UTC](https://community.cratedb.com/t/manual-installation-systemd-service-file/690/5 "2021-06-04T21:03:27Z")

</div>

Consider it done…! 🙃
