Simple installation on a Raspberry Pi and OpenSuse

I ran into some difficulties installing Crate on my favourite Linux distros and after solving them, @proddata kindly asked to write a short tutorial about it. It is really simple

Download Crate for AMD64

curl https://cdn.crate.io/downloads/releases/cratedb/x64_linux/crate-4.5.1.tar.gz --output crate.tar.gz

or ARM, respectively:

curl https://cdn.crate.io/downloads/releases/cratedb/aarch64_linux/crate-4.5.1.tar.gz --output crate.tar.gz

Unpack the downloaded file and change into die newly created directory:

tar -xzf crate.tar.gz && cd crate

and finally start crate.

./bin/crate

Opensuse and Raspbian both use systemd to manage services and naturally I wanted to use it to. With a few simple modifications of Crate’s Ubuntu unit file, the DB starts at boot time and can be controlled with the usual tools. Make sure to adjust the fields User, Group, WorkingDirectory, Environment, and ExecStart according to the location where you unpacked the tar.gz!

# /etc/systemd/system/cratedb.service

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

[Service]
Type=simple
User=fl
Group=users
WorkingDirectory=/home/fl/SW/crate

# default environment variables
Environment="CRATE_HOME=/home/fl/SW/crate"
Environment="CRATE_PATH_CONF=/home/fl/SW/crate/etc"
Environment="CRATE_PATH_LOG=/home/fl/SW/crate/logs"
Environment="CRATE_GC_LOG_DIR=/home/fl/SW/crate/logs"
Environment="CRATE_HEAP_DUMP_PATH=/home/fl/SW/crate"

ExecStart=/home/fl/SW/crate/bin/crate
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
2 Likes