Do I need Apache installed on VPS before instaling traccar?

CyberStorm 7 years ago

Hi,

I've been trying to get Traccar working for 2 days now. I've followed the guide in the documentation and also a guide on YouTube but no luck.
Traccar installs and the service starts. But I am unable to access toe traccar portal on either port 80 or the default port 8082.

The VPS I'm using has Ubuntu 16.04 and has no GUI just a command line stripped down version on Ubuntu.
My question is, do I need Apache installed first before installing Traccar?

If so, how do I configure Traccar to run on port 80?
I am aware that I need to specify port 80 in traccar.xml but is there anything I need to configure in Apache's configuration file to make it work on Port 80?

Slawek 7 years ago

maybe firewall ?

check

sudo ufw status verbose

Anton Tananaev 7 years ago

Why do you need Apache?

CyberStorm 7 years ago

Thanks for the reply Anton.
I couldn't get the Traccar page to load on either port 80 or port 8082 - So I assumed that you needed Apache for it to work.

I'm not sure where I went wrong during my install, but here are the exact steps I followed:

sudo apt-get update -y

sudo apt-get install unzip default-jre mysql-server -y

sudo mysql -u root -p

CREATE USER 'traccar@localhost' IDENTIFIED by 'password';

GRANT ALL ON *.* TO 'traccar@localhost';

FLUSH PRIVILEGES;

exit;

sudo mysql -u root -p

create database traccar;

exit;

wget https://github.com/traccar/traccar/releases/download/v4.0/traccar-linux-4.0.zip

unzip traccar-linux-*.zip

sudo ./traccar.run

nano traccar.xml
<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE properties SYSTEM 'http://java.sun.com/dtd/properties.dtd'>
<properties>

    <entry key="config.default">./conf/default.xml</entry>

    <entry key='web.port'>80</entry>

    <entry key='geocoder.enable'>false</entry>

    <entry key='database.driver'>com.mysql.jdbc.Driver</entry>
    <entry key='database.url'>jdbc:mysql://localhost/traccar?allowMultiQueries=$
    <entry key='database.user'>root</entry>
    <entry key='database.password'>password_i_set</entry>

    <entry key='server.timeout'>120</entry>

</properties>

Save the text file as traccar.xml

sudo cp traccar.xml /opt/traccar/conf/

sudo rm -f traccar.run README.txt traccar-linux-*.zip

sudo /opt/traccar/bin/startDaemon.sh

tail -f /opt/traccar/logs/wrapper.log.*

Anton Tananaev 7 years ago

You don't need Apache.

Slawek 7 years ago

What is in log file ?

    <entry key='database.driver'>com.mysql.jdbc.Driver</entry> 
    <entry key='database.url'>jdbc:mysql://127.0.0.1:3306/traccar?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'>root</entry> 
    <entry key='database.password'>your_password</entry>
Slawek 7 years ago

Uninstall this version

sudo /opt/traccar/bin/stopDaemon.sh
sudo /opt/traccar/bin/uninstallDaemon.sh
sudo rm -R /opt/traccar

Install new

wget https://github.com/traccar/traccar/releases/download/v4.5/traccar-linux-64-4.5.zip

unzip traccar-linux-*.zip

sudo ./traccar.run

Edit /opt/traccar/conf/traccar.xml

<entry key='database.driver'>com.mysql.jdbc.Driver</entry> 
    <entry key='database.url'>jdbc:mysql://127.0.0.1:3306/traccar?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'>root</entry> 
    <entry key='database.password'>your_password</entry>

Run Traccart

sudo systemctl start traccar.service

Clear

sudo rm -f traccar.run README.txt traccar-linux-*.zip

Check log in /opt/traccar/logs

Ahmed Mahmoud 6 years ago

I just have a question, if there is no apache required how to configure ssl certificate in case we need to use https instead of http for the ip or domain name?

Anton Tananaev 6 years ago

If you need SSL, you need Apache or other proxy.