Install Traccar to a folder different from /opt/traccar

gustavofarias4 years ago

I would like to install 2 instances of Traccar on the same server.
I think changing the web port, the protocol ports and the database schema of the second instance is enough to avoid any interference between the two instances.

But how can I change the default installation folder?

Anton Tananaev4 years ago

You can just copy the folder and create a new systemd service config.

gustavofarias4 years ago

Can I simply create a copy of /etc/systemd/system/traccar.service as traccar2.service and change the contents to the below?

[Unit]
Description=traccar2
After=network.target

[Service]
Type=simple
WorkingDirectory=/opt/traccar2
ExecStart=/opt/traccar2/jre/bin/java -jar tracker-server.jar conf/traccar.xml
SyslogIdentifier=traccar2
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target
Anton Tananaev4 years ago

I don't see why not.

gustavofarias4 years ago

What I'm asking is if this is enough to make the copy of traccar work as a daemon that starts automatically on system reboot etc. like the original.

Anton Tananaev4 years ago

Should be enough.

Macan4 years ago

gustavofarias are you managed to create working two instance on the same IP address?

  1. I copied traccar directory from the first server and created directory called traccar2 and paste all files from traccar first server directory
    2.then I change the port in the config file to 8083
    3.then as Anton sad I change the traccar.service file and rename file to traccar2.service and just use the command service traccar2 start but server doesnt start, do I need something else to edit ?
Anton Tananaev4 years ago

You should probably share details about the errors that you get.

Macan4 years ago

Anton sorry for taking your time and thank you for the answer, it was just a stupid mistake with permission files after I paste the files to the new directory.
I successfully ran three instances over one IP address.

Thank you.

jay3 years ago

followed all of the above steps, just to add, I changed my device ports from 5xxx to 6xxx on default xml . Created a new DB traccar2 on mysql . Changed web port to 8083. currently have 2 instances, working now for a few hours.

Col2 months ago

hello, sorry for reply this old topic, but i think i can not found solution for how to create windows service for my another traccar instances, please help.

thanks in advance.