# This document is OBSOLETE, please use the port instead
# This document shows how to install traccar (http://www.traccar.org) 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 'http://downloads.sourceforge.net/project/traccar/traccar-linux-64-2.2.zip?r=http%3A%2F%2Fwww.traccar.org%2Fdownload.jsp'
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 '127.0.0.1' 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 <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.