software:middleware:installation
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Vorhergehende ÜberarbeitungNächste Überarbeitung | |||
— | software:middleware:installation [2019/03/19 15:43] – Typo jau | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
+ | |||
+ | ====== Installation der Middleware ====== | ||
+ | |||
+ | This installs the middleware and the frontend. You also need to install the logger (vzlogger). | ||
+ | |||
+ | ===== Voraussetzungen ===== | ||
+ | * PHP 7.1 (nicht verfügbar in Raspbian Stretch!) | ||
+ | * Doctrine 2.5 | ||
+ | * MySQL, MariaDB, PostgreSQL oder SQLite + PDO Treiber | ||
+ | * APC (optional, aber empfohlen) | ||
+ | * jpGraph (optional, zum Plotten von PNG Grafiken) | ||
+ | * Apache mod_rewrite (optional) | ||
+ | |||
+ | Es eigenen sich hier Debian oder Ubuntu, sowie für den Raspberry Pi: Raspbian oder Raspbian Light.(" | ||
+ | Die Abhängigkeiten lassen sich schnell mit folgendem Befehl installieren: | ||
+ | < | ||
+ | </ | ||
+ | bzw. für PostgreSQL | ||
+ | < | ||
+ | |||
+ | Für die manuelle Installation wird zudem " | ||
+ | |||
+ | ==== Vollautomatisiert mit Ansible und DebOps ==== | ||
+ | |||
+ | Siehe hierzu [[https:// | ||
+ | |||
+ | |||
+ | ===== Install-Skript (empfohlene Installationsmethode) ===== | ||
+ | < | ||
+ | wget https:// | ||
+ | </ | ||
+ | < | ||
+ | bash install.sh | ||
+ | </ | ||
+ | |||
+ | Das sollte dann ablaufen: | ||
+ | |||
+ | < | ||
+ | pi@raspberrypi: | ||
+ | volkszaehler.org installation script | ||
+ | |||
+ | checking prerequisites: | ||
+ | | ||
+ | awk: / | ||
+ | sed: /bin/sed | ||
+ | grep: /bin/grep | ||
+ | wget: / | ||
+ | | ||
+ | | ||
+ | git: / | ||
+ | |||
+ | checking php version: 7.3.2-3 >= 7.1, ok | ||
+ | |||
+ | volkszaehler setup... | ||
+ | volkszaehler path? [/ | ||
+ | git clone volkszaehler.org into / | ||
+ | Cloning into '/ | ||
+ | remote: Counting objects: 11087, done. | ||
+ | remote: Compressing objects: 100% (11/11), done. | ||
+ | remote: Total 11087 (delta 5), reused 9 (delta 3), pack-reused 11073 | ||
+ | Receiving objects: 100% (11087/ | ||
+ | Resolving deltas: 100% (6085/ | ||
+ | link from webserver to volkszaehler directory? [/ | ||
+ | linking / | ||
+ | |||
+ | checking 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: / | ||
+ | |||
+ | installing dependencies... | ||
+ | / | ||
+ | Loading composer repositories with package information | ||
+ | Updating dependencies | ||
+ | Package operations: 40 installs, 0 updates, 0 removals | ||
+ | - Installing psr/log (1.0.2): Downloading (100%) | ||
+ | - Installing symfony/ | ||
+ | - Installing symfony/ | ||
+ | - Installing symfony/ | ||
+ | - Installing doctrine/ | ||
+ | - Installing doctrine/ | ||
+ | - Installing doctrine/ | ||
+ | - Installing doctrine/ | ||
+ | - 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 guzzlehttp/ | ||
+ | - Installing ratchet/ | ||
+ | - Installing cboden/ | ||
+ | - Installing react/ | ||
+ | - Installing ringcentral/ | ||
+ | - Installing react/http (dev-master cd15204): Cloning cd15204bd1 from cache | ||
+ | - Installing paragonie/ | ||
+ | - Installing monolog/ | ||
+ | - Installing react/ | ||
+ | - Installing react/cache (v0.4.1): Downloading (100%) | ||
+ | - Installing react/dns (v0.4.11): Downloading (100%) | ||
+ | - Installing react/ | ||
+ | - Installing symfony/ | ||
+ | - Installing mkraemer/ | ||
+ | - Installing php-pm/ | ||
+ | - Installing symfony/ | ||
+ | - Installing symfony/ | ||
+ | - Installing php-pm/ | ||
+ | - Installing doctrine/ | ||
+ | - Installing doctrine/ | ||
+ | Writing lock file | ||
+ | Generating autoload files | ||
+ | |||
+ | /home/pi | ||
+ | |||
+ | volkszaehler.org is not configured yet. creating new config from sample config file. | ||
+ | mysql admin user? [root] | ||
+ | mysql admin password? [] raspberry | ||
+ | mysql database? [volkszaehler] | ||
+ | mysql user? [vz] | ||
+ | mysql password? [demo] | ||
+ | mysql admin to volkszaehler datdabase? [vz-admin] | ||
+ | mysql admin password? [secure] | ||
+ | |||
+ | create volkszaehler.org database and admin user? [y] | ||
+ | creating database volkszaehler... | ||
+ | ATTENTION: This operation should not be executed in a production environment. | ||
+ | creating db user vz-admin... | ||
+ | Creating database schema... | ||
+ | / | ||
+ | Processing entity " | ||
+ | Processing entity " | ||
+ | Processing entity " | ||
+ | Processing entity " | ||
+ | Processing entity " | ||
+ | Processing entity " | ||
+ | Database schema created successfully! | ||
+ | |||
+ | Proxy classes generated to "/ | ||
+ | /home/pi | ||
+ | |||
+ | create volkszaehler.org database user? [y] | ||
+ | creating db user vz with proper rights... | ||
+ | |||
+ | allow channel deletion? [n] y | ||
+ | granting db user vz delete rights... | ||
+ | |||
+ | insert demo data in to database? [n] | ||
+ | |||
+ | </ | ||
+ | |||
+ | Das Script fragt, was es wohin installieren soll. | ||
+ | |||
+ | ==== Webserver per PPM (empfohlene Methode)==== | ||
+ | Der PPM-Webserver auf Basis von PHP läuft wesentlich Performanter als Apache2 und ist gerade auf schwacher Hardware wie RaspberryPi zu empfehlen. | ||
+ | |||
+ | - Systemd Service einrichten '' | ||
+ | [Unit] | ||
+ | Description=Volkszaehler.org Middleware | ||
+ | After=syslog.target network.target | ||
+ | Requires= | ||
+ | |||
+ | [Service] | ||
+ | ExecStart=/ | ||
+ | ExecReload=/ | ||
+ | StandardOutput=journal | ||
+ | Restart=always | ||
+ | |||
+ | [Install] | ||
+ | WantedBy=multi-user.target </ | ||
+ | - Server Port anpassen '' | ||
+ | " | ||
+ | - Middleware Weiterleitung '' | ||
+ | title: 'Local (default)', | ||
+ | url: '', | ||
+ | live: 8082</ | ||
+ | - Systemd Service bei boot aktiveren '' | ||
+ | - Systemd Service starten '' | ||
+ | |||
+ | ==== Alternative: | ||
+ | * Pakete installieren '' | ||
+ | * mod_rewrite aktivieren: '' | ||
+ | * Default VirtualHost bearbeiten: '' | ||
+ | ' In der Datei, neben ''< | ||
+ | < | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | * Apache Config bearbeiten um Rewrite zu erlauben: '' | ||
+ | * In der Datei den Abschnitt suchen: | ||
+ | < | ||
+ | < | ||
+ | Options Indexes FollowSymLinks | ||
+ | AllowOverride None | ||
+ | Require all granted | ||
+ | </ | ||
+ | </ | ||
+ | * 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. | ||
+ | |||
+ | ===== 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 / | ||
+ | </ | ||
+ | |||
+ | === Apache konfigurieren === | ||
+ | * mod_rewrite aktivieren: | ||
+ | < | ||
+ | sudo a2enmod rewrite | ||
+ | </ | ||
+ | |||
+ | * Default VirtualHost bearbeiten: | ||
+ | < | ||
+ | / | ||
+ | DocumentRoot / | ||
+ | </ | ||
+ | |||
+ | * unter < | ||
+ | < | ||
+ | AllowOverride FileInfo Limit Options Indexes Authconfig | ||
+ | </ | ||
+ | |||
+ | === Alternativ: nginx konfigurieren === | ||
+ | < | ||
+ | server { | ||
+ | listen 80; | ||
+ | listen [::]:80; | ||
+ | server_name volkszaehler.org; | ||
+ | |||
+ | root / | ||
+ | |||
+ | index index.php index.html; | ||
+ | |||
+ | location / { | ||
+ | try_files $uri $uri/ =404; | ||
+ | } | ||
+ | location ~ \.php { | ||
+ | include snippets/ | ||
+ | # # With php5-cgi alone: | ||
+ | # | ||
+ | # With php5-fpm: | ||
+ | fastcgi_pass unix:/ | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Wichtig ist dass in der config in der Zeile " | ||
+ | |||
+ | |||
+ | === Installation der benötigten Module === | ||
+ | |||
+ | == Zunächst PHP Paketmanager Composer von getcomposer.org installieren == | ||
+ | |||
+ | < | ||
+ | cd /tmp | ||
+ | curl -sS https:// | ||
+ | sudo mv composer.phar / | ||
+ | sudo chmod +x / | ||
+ | </ | ||
+ | |||
+ | == Ahängigkeiten laden und installieren (v.a. Doctrine) == | ||
+ | |||
+ | < | ||
+ | cd / | ||
+ | composer install | ||
+ | </ | ||
+ | |||
+ | === Konfiguration der Middleware === | ||
+ | < | ||
+ | cd / | ||
+ | cp volkszaehler.conf.template.php volkszaehler.conf.php | ||
+ | edit volkszaehler.conf.php: | ||
+ | $config[' | ||
+ | $config[' | ||
+ | $config[' | ||
+ | $config[' | ||
+ | </ | ||
+ | |||
+ | Alternativ wird die Installation in der [[http:// | ||
+ | |||
+ | === Datenbank konfigurieren === | ||
+ | * Datenbank-User anlegen: | ||
+ | |||
+ | < | ||
+ | phpmyadmin: | ||
+ | Home -> " | ||
+ | Benutzername: | ||
+ | Host: localhost | ||
+ | Passwort: < | ||
+ | keine globalen Rechte vergeben! | ||
+ | -> ok | ||
+ | oder: | ||
+ | CREATE USER ' | ||
+ | </ | ||
+ | |||
+ | * Datenbank anlegen: | ||
+ | < | ||
+ | phpmyadmin | ||
+ | Home -> " | ||
+ | oder: | ||
+ | CREATE DATABASE `volkszaehler`; | ||
+ | </ | ||
+ | |||
+ | * Tabellen anlegen: | ||
+ | < | ||
+ | # cd / | ||
+ | # php bin/ | ||
+ | ATTENTION: This operation should not be executed in a production environment. | ||
+ | |||
+ | Creating database schema... | ||
+ | Database schema created successfully! | ||
+ | </ | ||
+ | |||
+ | * Demoinhalte importieren: | ||
+ | < | ||
+ | Tabelle " | ||
+ | " | ||
+ | </ | ||
+ | oder: | ||
+ | < | ||
+ | cd / | ||
+ | cat entities.sql properties.sql data-demoset1.sql | mysql -uroot volkszaehler -p | ||
+ | </ | ||
+ | |||
+ | * Rechte setzen: | ||
+ | < | ||
+ | |||
+ | Datenbank " | ||
+ | " | ||
+ | Host: " | ||
+ | Db: " | ||
+ | User: " | ||
+ | Table_name: " | ||
+ | Table_priv: " | ||
+ | | ||
+ | oder: | ||
+ | GRANT select, update, insert ON volkszaehler.* TO vz@localhost; | ||
+ | </ | ||
+ | |||
+ | * Nun noch ein Passwort für den mysql-Administrator " | ||
+ | < | ||
+ | mysqladmin password -u root "< | ||
+ | mysqladmin reload -p | ||
+ | </ | ||
+ | |||
+ | ====== Aktualisierung der Middleware einschließlich des Frontends ====== | ||
+ | |||
+ | Nachdem Volkszähler im Zuge der Installation eine Kopie des git Repositories erstellt, kann die Installation auch aus diesem Repository aktualisiert werden. | ||
+ | |||
+ | Eine Beschreibung findet sich im Kapitel zu [[/ | ||
+ | |||
+ | |||
+ | ====== phpMyAdmin installieren ====== | ||
+ | <note important> | ||
+ | MySQL-Superuser ist: '' | ||
+ | phpMyAdmin-Superuser ist: '' | ||
+ | |||
+ | ==== Debian Stretch ==== | ||
+ | < | ||
+ | Nach Installation der nötigen Pakete wird das Konfigurationsscript gestartet. Es konfiguriert Apache und fragt nach einem Passwort für den neu anzulegenden User '' | ||
+ | <note warning> | ||
+ | Auch Apache wird automatisch neu gestartet. | ||
+ | <note important> | ||
+ | Um dem neuen User volle Adminrechte zu gewähren: | ||
+ | < | ||
software/middleware/installation.txt · Zuletzt geändert: 2023/03/27 21:14 von joha