How to install Traccar server on VPS

dlevak8 years ago

How to install Traccar on VPS
Ubuntu-15.04-x86_64
THIS IS EXAMPLE
and i have problem.
When you connected to Putty, I give following commands:

  1. su
  2. apt-get update
  3. wget url_from_my_server.com/traccar-linux-64-3.5.zip
  4. sudo apt-get install unzip
    If you disagree with the command SUDO that need apt-get sudo install
  5. unzip traccar-linux-64-3.5.zip
  6. dpkg --configure -a
  7. apt-get install mysql-server phpmyadmin unzip
    • monitor the data going to and assign the root password: Lozinka1
    • Configure database for phpmyadmin with dbconfig-common? Y
    • Password of the database's administrative user: <strong>Lozinka1a</strong>
    • MySQL aplication password for phpmyadmin: <strong>Lozinka1a</strong>
    • Password confirmation: <strong>Lozinka1a</strong>
    • Web server to reconfigure automatically: <strong>1</strong>
    • here we have a problem of constantly offering me to go over the configuration
      Press <strong>4</strong> for abort
  8. vi /opt/traccar/conf/linux.cfg
  9. Paste bellow code:
<entry key="database.driver">com.mysql.jdbc.Driver</entry>
<entry key="database.dataSource">com.mysql.jdbc.jdbc2.optional.MysqlDataSource</entry>
<entry key="database.url">jdbc:mysql://localhost/upaljac?allowMultiQueries=true&autoReconnect=true</entry>
<entry key='database.user'>dlevak</entry>
<entry key='database.password'>Lozinka1</entry>
  1. Press <strong>ESC</strong>
  2. Write :wq
  • if not saved to do the following:
    writes the following message: <strong>"/opt/traccar/conf/linux.cfg" E212: Can't open file for writing
  1. Press ENTER
  2. Since I can't get out of the console, I turn off the terminal and connect again via Putty, enter my login details and that's it. :)
  3. sudo su
  4. cd /opt
  5. mkdir traccar
  6. cd traccar
  7. mkdir conf
  8. cd conf
  9. vi /opt/traccar/conf/linux.cfg
  10. Paste code:
<entry key="database.driver">com.mysql.jdbc.Driver</entry>
<entry key="database.dataSource">com.mysql.jdbc.jdbc2.optional.MysqlDataSource</entry>
<entry key="database.url">jdbc:mysql://localhost/upaljac?allowMultiQueries=true&autoReconnect=true</entry>
<entry key='database.user'>dlevak</entry>
<entry key='database.password'>Lozinka1</entry>
  1. :wq
  2. Press Enter
    Now it's been all right.
  3. sudo apt-get install openjdk-7-jre
  4. Y
  5. When wrote:
    New password for the MySQL "root" user: Lozinka
    Repeat password for the MySQL "root" user: Lozinka
  6. When wrote:
    Configure database for phpmyadmin with dbconfig-common? Y
  7. Password of the database's administrative user: Lozinka1a
  8. Web server to reconfigure automaticaly:1 (for apache)
  9. 4 (for ignore)
  10. Restart the console because it is something crazy, and re-entry.
  11. su
  12. sudo ./traccar.run
  13. sudo /opt/traccar/bin/traccar start
    <em>Starting traccar...
    Waiting traccar....
    running: PID 13948</em>
  14. apt-get install ufw
  15. ufw allow 8082/tcp
  16. ufw allow 8082/udp
  17. Enter IP in my browser - xxx.xxx.xxx.xxx:8082 but, normaly not work. What is next step?
beryindo8 years ago

Simple install traccar

https://www.traccar.org/forums/topic/how-to-install-traccar-server-on-vps/

install java firts ubuntu
$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer
$ sudo apt-get install oracle-java8-set-default

install traccar
$ cd /opt
$ wget https://github.com/tananaev/traccar/releases/download/v3.5/traccar-linux-64-3.5.zip
$ unzip traccar-linux-64-3.5.zip
$ chmod +x traccar.run
$ sudo ./traccar.run
$ sudo /opt/traccar/bin/traccar start

check http://youripaddress:8082

dlevak8 years ago

beryindo, thank you!!!

It`s work! Some command not worked, because i missing install other commands.

This is other commands:

$ sudo apt-get install python-software-properties
$ apt-get install software-properties-common
$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
- do you accept the Oracle binary code license terms:
$ Y
$ sudo apt-get install oracle-java8-set-default (not worked but i need):
$ sudo dpkg --configure -a
- new password for the MySQL "root" user: Lozinka1
- repeat password for the mysql "root" user: Lozinka1
$ cd /opt
$ wget https://github.com/tananaev/traccar/releases/download/v3.5/traccar-linux-64-3.5.zip
$ unzip traccar-linux-64-3.5.zip
$ chmod +x traccar.run
$ sudo ./traccar.run
$ sudo /opt/traccar/bin/traccar start

Check ip xxx.xxx.xxx.xxx:8082/ and works! ;)

beryindo8 years ago

nice. how to migrasi databse to mysql ?

Anton Tananaev8 years ago

MySQL configuration:

https://www.traccar.org/mysql/

dlevak8 years ago
  1. How can I set over the terminal that all my records older than 100 days are automatically deleted? Is that entered on vi /opt/traccar/conf/linux.cfg ?

  2. I can't enter to phpmyadmin.
    We don't accept my username and password

Anton Tananaev8 years ago
  1. There is no config option to remove old records. If you are using MySQL, you can just set up a shell script that would remove old records.

  2. Not sure how it's related to Traccar.

Where did you get /opt/traccar/conf/linux.cfg? It's an old path. Correct new one is /opt/traccar/conf/traccar.xml.

ceceps8 years ago

Hello Anton.

My Server on ubuntu 15.04 already running Nginx with VestaCP and ufw firewall, also has install traccar server with mysql setup as https://www.traccar.org/mysql/. Traccar daemon is running well and table in mysql successful created but when I run in htttp://my_domain:8082. The server is error. Port 8082 has open on ufw firewall, I look on Logs appears here, I had setup debug to know this problem.

DEBUG  | wrapperp | 2016/08/01 05:37:00 | Send a packet PING : ping 0005cc95
INFO   | jvm 1    | 2016/08/01 05:37:00 | WrapperManager Debug: Received a pack$
INFO   | jvm 1    | 2016/08/01 05:37:00 | WrapperManager Debug: Send a packet P$
DEBUG  | wrapperp | 2016/08/01 05:37:00 | read a packet PING : ping 0005cc95
DEBUG  | wrapperp | 2016/08/01 05:37:04 | Send a packet PING : ping 0005ccbe
INFO   | jvm 1    | 2016/08/01 05:37:05 | WrapperManager Debug: Received a pack$
INFO   | jvm 1    | 2016/08/01 05:37:05 | WrapperManager Debug: Send a packet P$
DEBUG  | wrapperp | 2016/08/01 05:37:05 | read a packet PING : ping 0005ccbe

when I check port 8082 with nmap it appers like this ?

8082/tcp  open  blackice-alerts

It's right ?
How to solve this ?

Thank's in advance.

Anton Tananaev8 years ago

I think your server is freezing. What are the hardware specs?

ceceps8 years ago

My Server not freezing, It still works well on port 80 run by PHP website

But here my VPS spec hardware

  • Intel(R) Xeon(R) CPU E5-2609 0 @ 2.40GHz 64Bit
  • RAM 1 GB

PS:
as Info again
VPS running with

java version "1.7.0_95"
OpenJDK Runtime Environment (IcedTea 2.6.4) (7u95-2.6.4-0ubuntu0.15.04.1)
OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)

Before started traccar daemon when run command java -version it's fine that info appears but when I start traccar demon and It's successful running but when I run again java -version give this info

Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will

What should I do ?

Anton Tananaev8 years ago

I guess there is some problem with Java. Try to re-install it and get latest version.

ceceps8 years ago

Ok I after upgrade Java, and also I check that firewall on Vestacp not using ufw as default but iptables. After added rule manual on iptables it success now.

Thank's

engdoug8 years ago

Some problem here,

How to check if ufw is not the default?

ceceps8 years ago

Hi @engdoug, Iptables is default by most linux distro as firewall, and ufw is new tools and not install as default, so I have to compare firewall rule before using ufw and after using ufw using tools NMAP, scan first using command when ufw before active

nmap 127.0.0.1

what port that already open is port 8082 for traccar open, and compare that result after ufw install and active using sudo ufw status. If prt 8082 has active. Try open in browser is htttp://yourdomain:8082 it has success open or not.

In my VPS it has different result. so I conclusion it using default firewall are iptables. or as some error in logs traccar.

So after disable ufw and added rule using iptables for port 8082 for TCP and UDP protocol. Traccar it successful running now.

engdoug8 years ago

Thanks @ceceps!