Traccar server on Raspberry Pi 4

Raoul9 months ago

Hi AlfSolli,
With help of the "challenging" support of Anton (Thanks Anton!!), I was able to set-up the server completely, inclusive E-mail notifications, etc.
(Although in my hurry to get results I made some stupid mistakes like starting up in the wrong directory and messing up some Ubuntu files.).
Unfortunately after the power-down/power-up test yesterday evening the system responded not correctly any more.
Therefore I installed this morning Linux Ubuntu 20.10 Desktop again on my RPI and in a while I will install Traccar ARM 4.12.
In the meanwhile I picked up already some basic Linux commands .
Note that my Raspberry Pi 4 is a 64 bit machine, indeed with ARM architecture but traccar linux 4.12. did it well as Linux Ubuntu Desktop 20.10 also did well.
Thanks for your support!

AlfSolli9 months ago

Yes, it actually is! I stand corrected! :)

Raoul9 months ago

please find below a copy of my actions to start traccar:

raoul@Raspberry:~/Downloads/traccar-linux-arm-4.12$ sudo ./traccar.run
[sudo] password for raoul: 
Creating directory out
Verifying archive integrity...  100%   All good.
Uncompressing traccar  100%  
Created symlink /etc/systemd/system/multi-user.target.wants/traccar.service → /etc/systemd/system/traccar.service.
raoul@Raspberry:~/Downloads/traccar-linux-arm-4.12$ cd
raoul@Raspberry:~$ sudo systemctl start traccar
raoul@Raspberry:~$ cd /opt/traccar
raoul@Raspberry:/opt/traccar$ java -jar tracker-server.jar conf/traccar.xml
Command 'java' not found, but can be installed with:
sudo apt install default-jre              # version 2:1.11-72, or
sudo apt install openjdk-11-jre-headless  # version 11.0.10+9-0ubuntu1~20.10
sudo apt install openjdk-8-jre-headless   # version 8u282-b08-0ubuntu1~20.10
sudo apt install openjdk-13-jre-headless  # version 13.0.4+8-1
sudo apt install openjdk-14-jre-headless  # version 14.0.2+12-1
sudo apt install openjdk-15-jre-headless  # version 15+36-1
raoul@Raspberry:/opt/traccar$ 

Do I really need to install the default-jre ??

Raoul9 months ago

The point is: Java is already installed on my Raspberry!

AlfSolli9 months ago

It might just be missing from the path.
Try this command: echo $JAVA_HOME
If it returns empty, it probably needs to be set to where you have your JRE installed.

I couldn't install it on my old pi for some reason, but you can search for the java command with "locate java"

If that doesn't work, install mlocate with "apt install mlocate && updatedb" first.

Raoul9 months ago

Hi AlfSolli,

I was all day busy with the studying of a Linux course. More and more commands are revealed to me!
The command: echo $JAVA_HOME did not give any results.
The "locate java" command was indeed not found.
Thereafter I gave the command: apt install mlocate && updatedb. This was successful I guess
After "locate java" I got some 100 lines stating all the locations .
The first lines look as follows:

/etc/.java
/etc/java-11-openjdk
/etc/.java/.systemPrefs
/etc/.java/.systemPrefs/.system.lock
/etc/.java/.systemPrefs/.systemRootModFile

That is presumably the location where the java file is located?

So before giving the command : java -jar tracker-server.jar conf/traccar.xml
I should first go to the /etc directory. Correct?

Raoul9 months ago

....or copy the java file to /opt/traccar??

Raoul9 months ago

But in between al these 100 locations there is already a line:
/opt/traccar/jre/bin/java

AlfSolli9 months ago

Interesting. Seems like java is bundled with traccar. I wasn't aware of that.

Try running:

cd /opt/traccar [ENTER]
jre/bin/java -jar tracker-server.jar conf/traccar.xml [ENTER]
Raoul9 months ago

it returns:

bash: jre/bin/java: cannot execute binary file: Exec format error
Anton Tananaev9 months ago

You mentioned previously that you already have Java installed. Where is it?

RichardG9 months ago

Yes, Anton has advised in another post that Java is bundled with Traccar.
https://www.traccar.org/forums/topic/which-version-of-java-required-for-the-traccar-latest-version-in-linux/#post-46293

You should be able to run traccar from the command line. Try this:

/opt/traccar/jre/bin/java -jar tracker-server.jar /opt/traccar/conf/traccar.xml

You can open up another ubuntu shell/console and check to see if it's running

ps aux | grep traccar
root@ip-172-31-26-237:/home/ubuntu# ps aux | grep traccar
root     26604 85.5  5.2 2507500 107848 pts/1  Sl+  05:21   0:03 /opt/traccar/jre/bin/java -jar tracker-server.jar /opt/traccar/conf/traccar.xml
Raoul9 months ago

After "locate java" I got some 100 lines stating all the locations .
The first lines look as follows:

/etc/.java
/etc/java-11-openjdk
/etc/.java/.systemPrefs
/etc/.java/.systemPrefs/.system.lock
/etc/.java/.systemPrefs/.systemRootModFile

but there is also a line: /opt/traccar/jre/bin/java

Anton Tananaev9 months ago

So, just use your installed java for the java command. If paths are not configured properly, you can always specify full path.

Raoul9 months ago

Thanks a lot guys, unfortunately I am not yet to the level to understand your remarks. I think I will need a couple of days more to study Linux.
Out of the hundreds of locations with "java" in it I do not know where the real main java file is located.
I see locations with "/etc", locations with "/users/share", with "/snap", with "/var/lib", and so on.
I will fight my battle in the coming days.