OpenBSD

Information on this page might be outdated.

This document shows how to install Traccar on OpenBSD. It has been tested on a fresh install of OpenBSD 5.3 amd64.

First login as root

Set a PKG_PATH if not already done

export PKG_PATH=ftp://ftp.eu.openbsd.org/pub/OpenBSD/`uname -r`/packages/`uname -m`/

Let's install the mandatory packages (jdk will be installed but jre is sufficient)

pkg_add jdk unzip

Create the user and group which will run traccar using a low UID/GID as this is a service

groupadd -g 702 _traccar
useradd -g 702 -u 702 -c 'Traccar daemon' -L daemon -m -d /var/www/traccar -s /bin/ksh _traccar
chmod 700 /var/www/traccar

Switch to _traccar user

su - _traccar

Download and unpack traccar package for linux x64

ftp -o traccar.zip <URL>
unzip traccar.zip

Install traccar into intended directory and clean

sh traccar.run --noexec --target /var/www/traccar
rm traccar.zip traccar.run

Given traccar is not installed in the /opt directory, alter the configuration file

perl -p -i -e 's|opt|var/www|g' conf/traccar.cfg

It might be a good idea to let the web interface only run on localhost and set for example nginx run as a proxy with a SSL certificate for the web interface.

For that, search conf/traccar.conf and add '<entry key='http.address'>127.0.0.1</entry>' after the port 8082 entry.

configuring nginx to do the forwarding is out of the scope of this document

Create a startup script as traccar default startup involves a wrapper not available (yet) for OpenBSD

cat <<EOF >starttraccar.sh
#!/bin/sh
/usr/local/jdk-1.7.0/bin/java -jar tracker-server.jar conf/traccar.cfg
EOF
chmod 755 starttraccar.sh

Then, make traccar start at boot

exit # <-- go back to root
echo "su - _traccar -c 'cd /var/www/traccar && nohup ./starttraccar.sh &'" >> /etc/rc.local

Traccar is now installed, but you might need to personalize it, like remove all the protocols you don't need, use a MySQL database.