FreeBSD port and package

metacreo3 years ago

Hi to all daemon funs.

I created port and pkg for FreeBSD.
Tested on 12.2-RELEASE-p4 FreeBSD 12.2-RELEASE-p4 GENERIC amd64

Unofficial (for now) Port https://freebsd.newestvision.com/ports/www/traccar
Package https://freebsd.newestvision.com/packages/traccar-4.12.txz

MYSQL server must be installed.

To make from ports just copy traccar port directory to /usr/ports/www/
Must be /usr/ports/www/traccar with files inside.
cd to dir and exec make install clean
Port builds openjdk-jre11 and install traccar automatically.

To install from pkg just exec pkg add https://freebsd.newestvision.com/packages/traccar-4.12.txz
openjdk-jre11 will be added automatically.

Read port or pkg message.

Create DB.

CREATE DATABASE `traccar_db`;
CREATE USER 'traccar_user'@'127.0.0.1' IDENTIFIED WITH mysql_native_password BY 'traccar_password';
GRANT ALL PRIVILEGES ON `traccar_db`.* TO 'traccar_user'@'127.0.0.1'; 

Provide mysql login data in /usr/local/www/traccar/conf/traccar.xml file.

    <entry key='database.url'>jdbc:mysql://127.0.0.1:3306/traccar_db?serverTimezone=UTC&amp;useSSL=false&amp;allowMultiQueries=true&amp;autoReconnect=true&amp;useUnicode=yes&amp;characterEncoding=UTF-8&amp;sessionVariables=sql_mode=''</entry>
    <entry key='database.user'>traccar_user</entry>
    <entry key='database.password'>traccar_password</entry>

To enable Traccar Server, put the following in your /etc/rc.conf: traccar_enable="YES" or traccar_enable="NO" if you not want autostart.
Now you can start service traccar start

Traccar runs as www user.
Logs located at /var/log/traccar/

Enjoy

MK3 years ago

I didn't test the port but I've installed traccar manually of FreeBSD 12.2.

I wanted to add small notice to the FreeBSD startup script from this site: https://www.traccar.org/freebsd/

Generally it is ok, but the newest traccar (today: 4.14) does not work with openjdk8. It requires newer version, works with openjdk11 or openjdk11-jre. So the line:

: ${traccar_java:="/usr/local/openjdk8/bin/java"}    # path to your JRE

need to be changed to:

: ${traccar_java:="/usr/local/openjdk11-jre/bin/java"}    # path to your JRE

or:

: ${traccar_java:="/usr/local/openjdk11/bin/java"}    # path to your JRE

and of course openjdk11 or openjdk11-jre needs to be installed.

BTW: You can also use unmodified script and add to rc.conf:

traccar_java="/usr/local/openjdk11-jre/bin/java"
metacreo3 years ago

pkg openjdk11-jre-11 only needed. no need install openjdk11.

Anton Tananaev3 years ago

Updated, thank you.