software:middleware:installation
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende ÜberarbeitungNächste ÜberarbeitungBeide Seiten der Revision | ||
software:middleware:installation [2018/04/01 15:06] – PR 688 jau | software:middleware:installation [2022/12/14 15:08] – [PPM als Server (empfohlene Methode)] important note zu Proxies grimaldi | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
- | ===== Installation der Middleware ===== | + | ====== Installation der Middleware |
This installs the middleware and the frontend. You also need to install the logger (vzlogger). | This installs the middleware and the frontend. You also need to install the logger (vzlogger). | ||
- | ==== Voraussetzungen ==== | + | ===== Voraussetzungen |
- | * PHP 7.0 (bringt Rasbian Stretch schon mit) | + | * PHP 7.3 (z.B. debian ab Buster |
* Doctrine 2.5 | * Doctrine 2.5 | ||
- | * MySQL, MariaDB, PostgreSQL oder SQLite | + | * MySQL, MariaDB + PDO Treiber |
* APC (optional, aber empfohlen) | * APC (optional, aber empfohlen) | ||
- | | + | * Apache, nginx (optional) |
- | | + | |
- | Es eigenen | + | Es eignen |
Die Abhängigkeiten lassen sich schnell mit folgendem Befehl installieren: | Die Abhängigkeiten lassen sich schnell mit folgendem Befehl installieren: | ||
- | < | + | < |
</ | </ | ||
- | bzw. für PostgreSQL | ||
- | < | ||
Für die manuelle Installation wird zudem " | Für die manuelle Installation wird zudem " | ||
Zeile 26: | Zeile 23: | ||
- | ==== Install-Skript (empfohlene | + | ===== Install-Skript (empfohlene |
< | < | ||
wget https:// | wget https:// | ||
Zeile 50: | Zeile 47: | ||
git: / | git: / | ||
- | checking php version: 7.0.19-1 >= 7.0, ok | + | checking php version: 7.3.3-1 >= 7.1, ok |
volkszaehler setup... | volkszaehler setup... | ||
Zeile 56: | Zeile 53: | ||
git clone volkszaehler.org into / | git clone volkszaehler.org into / | ||
Cloning into '/ | Cloning into '/ | ||
- | remote: Counting objects: | + | remote: Enumerating objects: 4, done. |
- | remote: Compressing objects: 100% (11/11), done. | + | remote: Counting objects: |
- | remote: Total 11087 (delta | + | remote: Compressing objects: 100% (4/4), done. |
- | Receiving objects: 100% (11087/11087), 7.19 MiB | 2.61 MiB/s, done. | + | remote: Total 11981 (delta |
- | Resolving deltas: 100% (6085/6085), done. | + | Receiving objects: 100% (11981/11981), 7.51 MiB | 752.00 KiB/s, done. |
+ | Resolving deltas: 100% (6760/6760), done. | ||
link from webserver to volkszaehler directory? [/ | link from webserver to volkszaehler directory? [/ | ||
linking / | linking / | ||
checking composer... | checking composer... | ||
- | / | + | composer: /usr/local/bin/composer |
- | composer not found, downloading... | + | |
- | All settings correct for using Composer | + | |
- | Downloading... | + | |
- | + | ||
- | Composer (version 1.5.2) successfully installed to: / | + | |
- | Use it: php composer.phar | + | |
- | + | ||
- | /home/pi | + | |
- | composer: /home/pi/volkszaehler.org/composer.phar | + | |
installing dependencies... | installing dependencies... | ||
- | /home/pi/ | + | ~/ |
Loading composer repositories with package information | Loading composer repositories with package information | ||
Updating dependencies | Updating dependencies | ||
- | Package operations: | + | Package operations: |
- | - Installing | + | - Installing |
- | - Installing symfony/ | + | - Installing symfony/ |
- | - Installing symfony/ | + | - Installing symfony/http-foundation |
- | - Installing symfony/console (v3.3.9): Downloading (100%) | + | - Installing |
- | | + | |
- | - Installing doctrine/ | + | |
- | - Installing doctrine/ | + | |
- | - Installing | + | |
- | - Installing doctrine/ | + | |
- | - Installing doctrine/ | + | |
- | - Installing doctrine/ | + | |
- | - Installing andig/ | + | |
- | - Installing symfony/ | + | |
- | - Installing symfony/ | + | |
- | - Installing react/ | + | |
- | - Installing evenement/ | + | |
- | - Installing react/ | + | |
- | - Installing react/ | + | |
- | - Installing react/ | + | |
- Installing psr/ | - Installing psr/ | ||
- | - Installing guzzlehttp/ | + | - Installing guzzlehttp/ |
- | - Installing ratchet/ | + | - Installing react/ |
- | - Installing cboden/ | + | - Installing react/ |
- | - Installing | + | - Installing react/ |
- | - Installing | + | - Installing evenement/ |
- | - Installing | + | - Installing react/ |
- | - Installing | + | - Installing react/cache (v0.5.0): Downloading (100%) |
- | - Installing | + | - Installing react/dns (v0.4.16): Downloading (100%) |
- | - Installing | + | - Installing react/ |
- | - Installing | + | - Installing ratchet/ |
- | - Installing | + | - Installing cboden/ |
- | - Installing | + | - Installing |
- | - Installing symfony/process | + | |
- | - Installing | + | - Installing |
- | - Installing | + | - Installing |
- | - Installing symfony/ | + | - Installing doctrine/cache (v1.8.0): Downloading (100%) |
- | - Installing symfony/ | + | - Installing |
- | - Installing | + | - Installing |
- | - Installing | + | - Installing doctrine/ |
- | - Installing | + | - Installing |
+ | - Installing | ||
+ | - Installing doctrine/ | ||
+ | - Installing | ||
+ | - Installing | ||
+ | | ||
+ | - Installing symfony/polyfill-ctype | ||
+ | - Installing | ||
+ | | ||
+ | - Installing | ||
+ | | ||
+ | - Installing symfony/ | ||
+ | - Installing andig/ | ||
+ | - Installing andig/ | ||
+ | - Installing react/ | ||
+ | - Installing ringcentral/ | ||
+ | - Installing react/http (v0.8.4): Downloading (100%) | ||
+ | - Installing http-interop/ | ||
+ | - Installing psr/log (1.1.0): Downloading (100%) | ||
+ | - Installing symfony/ | ||
+ | - Installing symfony/ | ||
+ | - Installing | ||
+ | | ||
+ | | ||
+ | | ||
+ | - Installing | ||
+ | - Installing | ||
+ | - Installing webpatser/ | ||
+ | Package http-interop/ | ||
Writing lock file | Writing lock file | ||
Generating autoload files | Generating autoload files | ||
- | + | ~ | |
- | install server-side graph generation (jpgraph, not required for frontend)? [n] | + | |
- | /home/pi | + | |
volkszaehler.org is not configured yet. creating new config from sample config file. | volkszaehler.org is not configured yet. creating new config from sample config file. | ||
- | mysql admin user? [root] | + | mysql root user? [root] |
- | mysql admin password? [] raspberry | + | mysql root password? [] raspberry |
mysql database? [volkszaehler] | mysql database? [volkszaehler] | ||
+ | mysql admin to volkszaehler database? [vz-admin] | ||
+ | mysql admin password? [] secure | ||
mysql user? [vz] | mysql user? [vz] | ||
mysql password? [demo] | mysql password? [demo] | ||
- | mysql admin to volkszaehler datdabase? [vz-admin] | ||
- | mysql admin password? [secure] | ||
create volkszaehler.org database and admin user? [y] | create volkszaehler.org database and admin user? [y] | ||
creating database volkszaehler... | creating database volkszaehler... | ||
- | ATTENTION: This operation should not be executed in a production environment. | ||
creating db user vz-admin... | creating db user vz-admin... | ||
- | Creating | + | creating |
- | /home/pi/ | + | ~/ |
- | Processing entity " | + | |
- | Processing entity " | + | ! |
- | Processing entity " | + | ! [CAUTION] This operation should not be executed in a production environment! |
- | Processing entity " | + | ! |
- | Processing entity " | + | |
- | Processing entity " | + | |
- | Database schema created successfully! | + | |
+ | |||
+ | [OK] Database schema created successfully! | ||
+ | |||
+ | |||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
- | Proxy classes generated to "/ | + | Proxy classes generated to "/ |
- | /home/pi | + | ~ |
create volkszaehler.org database user? [y] | create volkszaehler.org database user? [y] | ||
Zeile 165: | Zeile 175: | ||
Das Script fragt, was es wohin installieren soll. | Das Script fragt, was es wohin installieren soll. | ||
+ | ===== Webserver einrichten ===== | ||
+ | Im Folgenden sind 3 mögliche Serverkonfigurationen beschrieben. Für Kompatibiltät mit alten Scripts und Konfigurationen empfehlen wir bei PPM zusätzlich einen Proxy einzurichten. | ||
- | === Apache unter Debian " | + | ==== PPM als Server (empfohlene Methode) ==== |
- | * mod_rewrite aktivieren: | + | Der PPM-Webserver auf Basis von PHP läuft wesentlich Performanter als Apache2 und ist gerade auf schwacher Hardware wie RaspberryPi zu empfehlen. In Standardkonfiguration bedient er Anfragen auf Port 8080. |
- | < | + | |
- | sudo a2enmod rewrite | + | |
- | </ | + | |
- | | + | - Systemd Service einrichten '' |
- | < | + | [Unit] |
- | sudo nano /etc/apache2/sites-enabled/000-default | + | Description=Volkszaehler.org Middleware |
- | </code> | + | After=syslog.target network.target mysql.service |
+ | Requires= | ||
- | * In der Datei, neben: < DocumentRoot | + | [Service] |
- | < | + | ExecStart=/ |
- | / | + | ExecReload=/ |
+ | StandardOutput=journal | ||
+ | Restart=always | ||
+ | |||
+ | [Install] | ||
+ | WantedBy=multi-user.target </ | ||
+ | - Server Konfiguration anpassen | ||
+ | - '' | ||
+ | - ändern: ''" | ||
+ | - Middleware Weiterleitung '' | ||
+ | title: 'Local (default)', | ||
+ | url: '' | ||
+ | //live: 8082</ | ||
+ | - Systemd Service bei boot aktiveren '' | ||
+ | - Systemd Service starten '' | ||
+ | |||
+ | <note important> | ||
+ | ==== Apache als Proxy (empfohlene Methode) ==== | ||
+ | Dazu Apache auf die Weiterleitung zum PPM reduzieren. | ||
+ | - Module aktivieren< | ||
+ | sudo a2enmod proxy | ||
+ | sudo a2enmod proxy_http | ||
+ | sudo a2enmod rewrite</ | ||
+ | - Rewrite-Proxy aktivieren, '' | ||
+ | < | ||
+ | RewriteEngine On | ||
+ | RewriteRule ^middleware(.php)? | ||
+ | RewriteRule ^api(/.*)$ http:// | ||
+ | RewriteRule (.*) http:// | ||
+ | </ | ||
+ | </code> | ||
+ | - Default VirtualHost bearbeiten: '' | ||
+ | DocumentRoot | ||
</ | </ | ||
- | eintragen. | + | - Apache Config bearbeiten um Rewrite in .htaccess zu erlauben: '' |
+ | < | ||
+ | Options Indexes FollowSymLinks | ||
+ | AllowOverride None | ||
+ | Require all granted | ||
+ | </ | ||
+ | </ | ||
+ | - Dann den Apache nur noch neu starten '' | ||
+ | |||
+ | ==== Alternativ: nginx als Proxy ==== | ||
+ | Nginx ist ein schlanker Webserver/ | ||
- | * unter < | ||
- | neben: < | ||
< | < | ||
- | FileInfo Limit Options Indexes Authconfig | + | sudo apt install nginx |
+ | sudo rm / | ||
+ | sudo nano / | ||
</ | </ | ||
- | eintragen. Das " | + | In diese wird eingefügt: |
+ | < | ||
+ | # Volkszaehler | ||
- | Die Datei sollte dann so aussehen: | + | include / |
- | < | + | server { |
- | < | + | |
- | | + | listen [::]:80; |
+ | | ||
- | DocumentRoot | + | location |
- | < | + | proxy_pass http://127.0.0.1:8080; |
- | Options FollowSymLinks | + | |
- | AllowOverride None | + | } |
- | </Directory> | + | |
- | < | + | |
- | | + | |
- | AllowOverride FileInfo Limit Options Indexes AuthConfig | + | |
- | Order allow, | + | |
- | allow from all | + | |
- | </ | + | |
- | ScriptAlias | + | location |
- | < | + | rewrite ^/middleware(.php)? |
- | | + | |
- | Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch | + | } |
- | Order allow, | + | |
- | Allow from all | + | |
- | </ | + | |
- | ErrorLog ${APACHE_LOG_DIR}/error.log | + | location /api { |
+ | rewrite ^/api(/.*)? $1; | ||
+ | proxy_pass http:// | ||
+ | } | ||
- | # Possible values include: debug, info, notice, warn, error, crit, | + | location /frontend { |
- | # alert, emerg. | + | |
- | | + | proxy_pass http:// |
+ | } | ||
- | CustomLog ${APACHE_LOG_DIR}/access.log combined | + | # Konfigurationsbeispiel für eigene PHP-Scripte, |
- | </VirtualHost> | + | # von nginx unter http:// |
+ | # | ||
+ | # location / | ||
+ | # alias /var/ | ||
+ | # index index.nginx-debian.html; | ||
+ | # | ||
+ | # location ~ \.php { | ||
+ | # include snippets/fastcgi-php.conf; | ||
+ | # fastcgi_param SCRIPT_FILENAME $request_filename; | ||
+ | # fastcgi_pass unix:/ | ||
+ | # } | ||
+ | # } | ||
+ | } | ||
</ | </ | ||
+ | < | ||
- | === Apache unter Debian " | + | Installieren mit '' |
- | * mod_rewrite aktivieren: | + | Damit der nginx die Config lädt: |
< | < | ||
- | sudo a2enmod rewrite | + | sudo ln -s / |
</ | </ | ||
- | + | Dann nur noch Starten und in Bootprozess einbinden: | |
- | * Default VirtualHost bearbeiten ( die Datei: " | + | |
< | < | ||
- | sudo nano / | + | sudo systemctl start nginx |
+ | sudo systemctl enable nginx | ||
</ | </ | ||
- | | + | ==== Alternativ: Apache als Server (unter Debian " |
+ | < | ||
+ | | ||
+ | * mod_rewrite aktivieren: '' | ||
+ | * Default VirtualHost bearbeiten: '' | ||
+ | ' | ||
< | < | ||
/ | / | ||
</ | </ | ||
- | eintragen. | ||
- | Nach dem editieren und abspeichern | + | * Apache Config bearbeiten um Rewrite zu erlauben: '' |
+ | * In der Datei den Abschnitt suchen: | ||
< | < | ||
- | sudo systemctl restart apache2 | + | < |
+ | Options Indexes FollowSymLinks | ||
+ | AllowOverride None | ||
+ | Require all granted | ||
+ | </ | ||
</ | </ | ||
- | ausführen. | + | * in '' |
+ | |||
+ | Nach dem editieren und abspeichern der Datei '' | ||
Sollte es zu einem PHP Fehler beim Anlegen der Datenbank kommen versucht mal Doctrine per Hand zu Installieren. | Sollte es zu einem PHP Fehler beim Anlegen der Datenbank kommen versucht mal Doctrine per Hand zu Installieren. | ||
- | ==== Manuelle Installation | + | ==== Alternativ: nginx als Server |
- | + | <note>Möchte man von PPM auf nginx als Server umstellen sind auch die Änderungen an der Middleware-Konfiguration für PPM zurück zu nehmen: '' | |
- | === Download der volkszaehler.org Skripte === | + | |
- | Download der Skripte aus dem git Repository: | + | |
- | <code> | + | |
- | git clone git:// | + | |
- | sudo ln -sf ~/ | + | |
- | sudo chown -R www-data / | + | |
- | </ | + | |
- | + | ||
- | === Apache konfigurieren === | + | |
- | * mod_rewrite aktivieren: | + | |
- | < | + | |
- | sudo a2enmod rewrite | + | |
- | </ | + | |
- | + | ||
- | * Default VirtualHost bearbeiten: | + | |
- | < | + | |
- | / | + | |
- | DocumentRoot / | + | |
- | </code> | + | |
- | + | ||
- | * unter < | + | |
- | < | + | |
- | AllowOverride FileInfo Limit Options Indexes Authconfig | + | |
- | </ | + | |
- | + | ||
- | === Alternativ: nginx konfigurieren === | + | |
< | < | ||
server { | server { | ||
listen 80; | listen 80; | ||
listen [::]:80; | listen [::]:80; | ||
- | server_name volkszaehler.langhaarschneider.rocks; | + | server_name volkszaehler.org; |
- | root / | + | root / |
index index.php index.html; | index index.php index.html; | ||
Zeile 294: | Zeile 341: | ||
location ~ \.php { | location ~ \.php { | ||
include snippets/ | include snippets/ | ||
- | # # With php5-cgi alone: | + | # # With php7-cgi alone: |
# | # | ||
- | # With php5-fpm: | + | # With php7-fpm: |
- | fastcgi_pass unix:/ | + | fastcgi_pass unix:/ |
} | } | ||
} | } | ||
</ | </ | ||
+ | < | ||
- | Wichtig ist dass in der config in der Zeile " | + | Wichtig ist dass in der config in der Zeile " |
+ | ==== Alternativ: Lighttpd als Server ==== | ||
+ | Notwendige Rewrite-Regeln: | ||
+ | < | ||
+ | url.rewrite-if-not-file = ( | ||
+ | " | ||
+ | " | ||
+ | ) | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Manuelle Installation ===== | ||
+ | |||
+ | === Download der volkszaehler.org Skripte === | ||
+ | Download der Skripte aus dem git Repository: | ||
+ | < | ||
+ | git clone git:// | ||
+ | sudo ln -sf ~/ | ||
+ | sudo chown -R www-data / | ||
+ | </ | ||
=== Installation der benötigten Module === | === Installation der benötigten Module === | ||
Zeile 326: | Zeile 393: | ||
< | < | ||
cd / | cd / | ||
- | cp volkszaehler.conf.template.php volkszaehler.conf.php | + | cp config.dist.yaml config.yaml |
- | edit volkszaehler.conf.php: | + | </ |
- | | + | edit config.yaml: |
- | | + | < |
- | | + | db: |
- | | + | |
+ | port: 3306 | ||
+ | | ||
+ | password: demo | ||
+ | dbname: volkszaehler | ||
</ | </ | ||
Zeile 337: | Zeile 408: | ||
=== Datenbank konfigurieren === | === Datenbank konfigurieren === | ||
- | * Datenbank-User anlegen: | + | * Datenbank |
+ | < | ||
+ | mysql: | ||
+ | CREATE DATABASE `volkszaehler`; | ||
+ | |||
+ | oder phpmyadmin: | ||
+ | Home -> " | ||
+ | </ | ||
+ | * Datenbank-User anlegen: | ||
< | < | ||
- | phpmyadmin: | + | mysql: |
+ | GRANT ALL ON volkszaehler.* to ' | ||
+ | CREATE USER ' | ||
+ | GRANT USAGE ON volkszaehler.* TO ' | ||
+ | GRANT SELECT, UPDATE, INSERT ON volkszaehler.* TO ' | ||
+ | |||
+ | oder phpmyadmin: | ||
+ | Home -> " | ||
+ | Benutzername: | ||
+ | Host: localhost | ||
+ | Passwort: < | ||
+ | Vollzugriff (Grant All) auf DB volkszaehler erlauben. | ||
+ | -> ok | ||
Home -> " | Home -> " | ||
Benutzername: | Benutzername: | ||
Zeile 347: | Zeile 438: | ||
keine globalen Rechte vergeben! | keine globalen Rechte vergeben! | ||
-> ok | -> ok | ||
- | oder: | ||
- | CREATE USER ' | ||
- | </ | ||
- | |||
- | * Datenbank anlegen: | ||
- | < | ||
- | phpmyadmin | ||
- | Home -> " | ||
- | oder: | ||
- | CREATE DATABASE `volkszaehler`; | ||
</ | </ | ||
- | | + | * Tabellen anlegen: |
< | < | ||
# cd / | # cd / | ||
Zeile 401: | Zeile 482: | ||
</ | </ | ||
- | ===== Aktualisierung der Middleware einschließlich des Frontends ===== | + | === Webserver |
+ | Wie bereits [[/ | ||
- | Nachdem Volkszähler im Zuge der Installation eine Kopie des git Repositories erstellt, kann die Installation auch aus diesem Repository aktualisiert werden. | + | ====== Aktualisierung |
- | Eine Beschreibung findet sich im Kapitel zu [[/howto/git]]. | + | Wenn nur die '' |
+ | Nachdem Volkszähler im Zuge der Installation eine Kopie des git Repositories erstellt, kann die Installation aber auch aus diesem Repository aktualisiert werden. Eine Beschreibung findet sich im Kapitel zu [[/ | ||
- | ===== phpMyAdmin installieren ===== | + | |
+ | ====== phpMyAdmin installieren ====== | ||
+ | < | ||
<note important> | <note important> | ||
MySQL-Superuser ist: '' | MySQL-Superuser ist: '' | ||
Zeile 421: | Zeile 506: | ||
Um dem neuen User volle Adminrechte zu gewähren: | Um dem neuen User volle Adminrechte zu gewähren: | ||
< | < | ||
- | |||
- | ==== Debian Jessie ==== | ||
- | < | ||
- | < | ||
- | < | ||
- | |||
- | ==== Debian Wheezy ==== | ||
- | < | ||
- | < | ||
- | < | ||
software/middleware/installation.txt · Zuletzt geändert: 2024/05/03 12:52 von jau