Benutzer-Werkzeuge

Webseiten-Werkzeuge


software:controller:vzlogger:installation_en

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen RevisionVorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
software:controller:vzlogger:installation_en [2018/05/11 03:27] – draw level with german version installation_cpp-version jausoftware:controller:vzlogger:installation_en [2023/03/13 07:57] (aktuell) – Externe Bearbeitung 127.0.0.1
Zeile 4: Zeile 4:
 Our repository: https://github.com/volkszaehler/vzlogger\\ Our repository: https://github.com/volkszaehler/vzlogger\\
  
-Actually vzlogger and some of the libraries are only provided by sourcecode. They have to be compiled before use.+Actually vzlogger and sometimes the libraries are only provided by sourcecode. They have to be compiled before use.
 Select a working directory your user has writing permissions. For example the home directory: Select a working directory your user has writing permissions. For example the home directory:
 <code> <code>
 cd ~ cd ~
 </code> </code>
 +The most experience is collected from Debian and other Distributions close (Ubuntu, Raspian). The following guide is based on Debian "Bullseye" in April of 2022. Specific instructions for older Versions can be found in the history of this site.
  
 ===== Prerequisites for compiling vzlogger ===== ===== Prerequisites for compiling vzlogger =====
Zeile 15: Zeile 16:
  
 === Tools === === Tools ===
-  * git (package: git-core)+  * git
   * cmake   * cmake
   * pkg-config   * pkg-config
Zeile 31: Zeile 32:
   * libltdl >=0.8.0 (for OMS)   * libltdl >=0.8.0 (for OMS)
   * libleptonica-dev (for OCR)   * libleptonica-dev (for OCR)
 +  * libmosquitto-dev (for MQTT)
   * libunistring-dev (due to problem Ubuntu 18.04)   * libunistring-dev (due to problem Ubuntu 18.04)
  
 === Debian packages === === Debian packages ===
-On Debian-Jessie based distributios, most of these dependencies can easily be installed with:+On Debian based distributions, most of these dependencies can easily be installed with:
 (as root, consider running "apt-get update" first) (as root, consider running "apt-get update" first)
-<code>sudo apt-get install build-essential git-core cmake pkg-config subversion libcurl4-openssl-dev libgnutls28-dev libsasl2-dev uuid-dev libtool libssl-dev libgcrypt20-dev libmicrohttpd-dev libltdl-dev libjson-c-dev libleptonica-dev libunistring-dev dh-autoreconf</code> +<code>sudo apt-get install build-essential git cmake pkg-config subversion libcurl4-openssl-dev libgnutls28-dev libsasl2-dev uuid-dev libtool libssl-dev libgcrypt20-dev libmicrohttpd-dev libltdl-dev libjson-c-dev libleptonica-dev libmosquitto-dev libunistring-dev dh-autoreconf</code>
- +
-For Debian Wheezy: +
-<code>sudo apt-get install build-essential git-core cmake pkg-config subversion libcurl3-dev libgnutls-dev libsasl2-dev uuid-dev libtool libmicrohttpd-dev libcurl4-openssl-dev libssl-dev libltdl-dev libleptonica-dev libunistring-dev dh-autoreconf</code>+
  
 ===== Build by script ===== ===== Build by script =====
Zeile 62: Zeile 61:
 ./install.sh vzlogger ./install.sh vzlogger
 sudo systemctl start vzlogger sudo systemctl start vzlogger
 +</code>
 +
 +The based SML Library may (before) updated by:
 +<code>
 +cd vzlogger/libs/libsml
 +git pull
 +cd ../..
 +./install.sh libsml
 </code> </code>
  
Zeile 67: Zeile 74:
 In cases the script does not fit the conditions. In cases the script does not fit the conditions.
 <note warning>​Only for experienced users! Follow [[/software/controller/vzlogger/installation_en#build_by_script|build by script]] instead.</note> <note warning>​Only for experienced users! Follow [[/software/controller/vzlogger/installation_en#build_by_script|build by script]] instead.</note>
- 
-=== Building libjson === 
- 
-The best case is building libjson from source, which is simple too: 
-<code> 
-git clone -b json-c-0.12 https://github.com/json-c/json-c 
-cd json-c 
-sh autogen.sh 
-./configure 
-make 
-sudo make install 
-</code> 
- 
-Go back to your starting directory: <code>cd ..</code> 
  
 === Building libsml === === Building libsml ===
 +Debian provides a paket libsml-dev, but it's not well maintained and too old for our needs.
 <code> <code>
 git clone https://github.com/volkszaehler/libsml.git git clone https://github.com/volkszaehler/libsml.git
Zeile 106: Zeile 100:
 mkdir build mkdir build
 cd build cd build
-cmake ..+cmake -DBUILD_TEST=off ..
 make make
 sudo make install sudo make install
 </code> </code>
  
-if you are having trouble building with libsml, instead of just "cmake ..", use:+Go back to your starting directory: <code>cd ../..</code> 
 + 
 +== Build as Debian-paket ==  
 +The vzlogger repository contains code to build a "clean" paket for Debian.
 <code> <code>
-cmake .. -DSML_HOME=/path/to/libsml+git clone https://github.com/volkszaehler/vzlogger.git  
 +cd vzlogger  
 +apt build-dep . 
 +apt install devscripts  
 +debuild
 </code> </code>
- 
-Go back to your starting directory: <code>cd ../..</code> 
  
 === Building OMS === === Building OMS ===
Zeile 137: Zeile 136:
 If a update is necessary follow these steps: If a update is necessary follow these steps:
 <code> <code>
-sudo systemctl stop vzlogger 
 cd vzlogger cd vzlogger
 git pull git pull
 cd build cd build
-cmake ..+cmake -DBUILD_TEST=off ​..
 make make
 +sudo systemctl stop vzlogger
 sudo make install sudo make install
-cd ../.. 
 sudo systemctl start vzlogger sudo systemctl start vzlogger
 </code> </code>
Zeile 151: Zeile 149:
 Systemd is used to install and execute services in background (daemon). Systemd is used to install and execute services in background (daemon).
  
-The installscript asks you for installing the systemd unit file for you. If your computer uses systemd (Debian-Jessie) you may answer yes.+The installscript asks you for installing the systemd unit file for you. If your computer uses systemd (since Debian-Jessie) you may answer yes.
  
 If you want to copy and edit it by yourself you find a template under: [[https://github.com/volkszaehler/vzlogger/blob/master/etc/vzlogger.service|./etc/vzlogger.service]] If you want to copy and edit it by yourself you find a template under: [[https://github.com/volkszaehler/vzlogger/blob/master/etc/vzlogger.service|./etc/vzlogger.service]]
Zeile 174: Zeile 172:
 sudo systemctl enable vzlogger sudo systemctl enable vzlogger
 </code> </code>
 +
 +====== Run vzlogger with different user ======
 +
 +=== Elevated privileges for vzlogger binary ===
 +
 +<code>
 +sudo setcap 'cap_sys_nice=eip' /usr/local/bin/vzlogger
 +</code>
 +
 +<note>On Raspberry might still be problems with configuration of GPIOs. Earlier export in ''/etc/rc.local'' solves the problem.</note>
 +
 +=== Add Daemon-User ===
 +
 +Add a user without home-directory and generate password. 
 +<code>
 +sudo useradd -M vzlogger
 +sudo passwd vzlogger
 +</code>
 +
 +Add the user to the follwing groups:
 +<code>
 +sudo usermod -aG gpio vzlogger
 +sudo usermod -aG dialout vzlogger
 +sudo usermod -aG staff vzlogger
 +</code>
 +
 +For the logfile generate a sub-directory with adequate rights.
 +<code>
 +sudo mkdir /var/log/vzlogger
 +sudo chgrp staff /var/log/vzlogger
 +sudo chmod g+w /var/log/vzlogger
 +</code> 
 +
 +=== adapt vzlogger.conf ===
 +
 +The new location oft logfile has to be configured accordingly. ''/etc/vzlogger.conf'':
 +<code>
 +"log" : "/var/log/vzlogger/vzlogger.log",
 +</code>
 +
 +
 +=== adapt Systemd startscript ===
 +
 +Last change is to promote the new user in systemd startscript (see chapter above).
 +
 +Under [Service] add the following line:
 +<code>
 +User=vzlogger
 +</code>
 +
 +Systemd need to be restartet to activate the change:
 +
 +<code>
 +sudo systemctl daemon-reload
 +</code>
 +
 +=== Use-sase===
 +
 +This adaption is of particular interest in combination with meter-protocol "exec". Vzlogger doesn't have to be recompiled and the actions started by "exec" run with lower user-privilges.
  
 ====== Special hints ====== ====== Special hints ======
software/controller/vzlogger/installation_en.1526002034.txt.gz · Zuletzt geändert: 2018/05/11 03:27 von jau