View difference between Paste ID: E3tpHDp3 and N93VSsmm
SHOW: | | - or go back to the newest paste.
1
1 - apt-get -y update && apt upgrade -y
2
3
2 - Instalação do Java e MySQL
4
apt-get install unzip default-jre mysql-server wget
5
Troca da senha do banco
6
mysql -u root -p --execute="GRANT ALL PRIVILEGES on *.* to 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'traccar'; FLUSH PRIVILEGES;"
7
8
3 - Criar banco de dados "traccar"
9
echo "create database traccar" | mysql -u root -p
10
11
4 - Download fonte Traccar
12
wget https://github.com/traccar/traccar/releases/download/v4.2/traccar-linux-64-4.2.zip
13
14
5 - Extrair o pacote baixado com Unzip
15
unzip traccar-linux-*.zip
16
17
6 - Instalar Traccar
18
./traccar.run
19
20
7 - Criar arquivo de configuração
21
vi traccar.xml
22
23
<?xml version='1.0' encoding='UTF-8'?>
24
25
<!DOCTYPE properties SYSTEM 'http://java.sun.com/dtd/properties.dtd'>
26
27
<properties>
28
29
    <entry key="config.default">./conf/default.xml</entry>
30
31
    <entry key='web.port'>80</entry>
32
33
    <entry key='geocoder.enable'>false</entry>
34
35
    <entry key='database.driver'>com.mysql.jdbc.Driver</entry>
36
    <entry key='database.url'>jdbc:mysql://localhost/traccar?allowMultiQueries=true&amp;autoReconnect=true&amp;useUnicode=yes&amp;characterEncoding=UTF-8&amp;sessionVariables=sql_mode=''</entry>
37
    <entry key='database.user'>root</entry>
38
    <entry key='database.password'>root</entry>
39
    
40
    <entry key='server.timeout'>120</entry>
41
42
</properties>
43
44
8 - Copiar o Arquivo de Configuração para a pasta do traccar
45
cp traccar.xml /opt/traccar/conf/
46
47
9 - Remover fonts de instalação
48
rm -f traccar.run README.txt traccar-linux-*.zip
49
50
10- Configurar cron para limpar os logs diariamente
51
printf '#!/bin/sh\nfind /opt/traccar/logs/ -mtime +5 -type f -delete\n' > /etc/cron.daily/traccar-clear-logs && chmod +x /etc/cron.daily/traccar-clear-logs
52
53
11 - Start o traccar
54
/opt/traccar/bin/startDaemon.sh
55
56
12 - Checar Logs
57
tail -f /opt/traccar/logs/wrapper.log.*