Traccar can run on shared server (cPanel) standalone or in pair with OpenGTS. You need a few modifications to have it running.
Download and unpack the software. When trying to start installer on a server without root access we will get Permission denied'
wget https://github.com/tananaev/traccar/releases/download/v3.3/traccar-linux-64-3.3.zip
unzip traccar-linux-64-3.3.zip
bash traccar.run
Verifying archive integrity... All good.
Uncompressing traccar 100%
traccar.run: line 488: ./setup.sh: Permission denied
On shared server you will not be able to extraxt traccar to hardcoded /opt/traccar
. You will need to modify the destination path and also the default HTTP port.
./traccar.run --keep --noexec --target traccar
Creating directory traccar
Verifying archive integrity... All good.
Uncompressing traccar 100%
Optionally modify UNIX_PATH
in setup.sh
to use traccar
directory in your home directory (this step is not really needed as setup.sh
only tries to make traccar autostarting on server boot).
sed -i 's/UNIX_PATH="\/opt/UNIX_PATH="~/' ~/traccar/setup.sh
Update paths to your own home directory in XML config file:
sed -i "s#\/opt\/traccar#$HOME\/traccar#g" ~/traccar/conf/traccar.xml
Update HTTP port to a custom one assigned by your hosting provider (11111 in this example):
sed -i 's/>8082</>11111</' ~/traccar/conf/traccar.xml
Modify bin/traccar
by adding return 0;
under mustBeRootOrExit() {
and installdaemon() {
sed -i -e '/mustBeRootOrExit() {/a return 0;' -e '/installdaemon() {/a return 0;' ~/traccar/bin/traccar
This way you skip installation of startup script in its default location that is impossible on shared server anyway.
You can now start traccar with:
cd ~/traccar/bin/
./traccar start
Starting traccar...
Waiting for traccar......
running: PID:632085
Notes:
- Make sure JDK version is set to 1.7 or higher. Otherwise you may get
WrapperSimpleApp Error: Class org.traccar.Main found but could not be initialized: java.lang.UnsupportedClassVersionError: org/traccar/Main : Unsupported major.minor version 51.0
- Traccar wrapper spawns another JVM so make sure to have permission to run 2 JVMs at a time if you run an JVM-based application server in parallel.
- Traccar will start with 128MB of JVM heap (actually using a 30MB idle and freshly started). If you ever need more then enabling
PASS_THRU
variable passes arguments starting from the second on to the JVM. You can then pass-Xmx256
for example. - You may get:
WrapperSimpleApp Error: java.lang.OutOfMemoryError: unable to create new native thread
. Make sure number of processes (threads) for your account is more than 200 especially when running under CloudLinux and alongside another JVM.
References:
https://www.traccar.org/devices/ https://www.traccar.org/opengts/ https://github.com/tananaev/traccar/issues/1389