Benutzer-Werkzeuge

Webseiten-Werkzeuge


software:middleware:installation

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.


Vorhergehende Überarbeitung
software:middleware:installation [2018/12/14 07:46] – "langhaarschneider" entfernt 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.0 (bringt Rasbian Stretch schon mit) 
-  * 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.( "Stretch"-Version)\\ 
-Die Abhängigkeiten lassen sich schnell mit folgendem Befehl installieren: 
-<code>sudo apt-get install git-core libapache2-mod-php7.0 php7.0-cli php7.0-mysql php-apcu mysql-server mysql-client php7.0-xml php-mbstring ca-certificates apache2 
-</code> 
-bzw. für PostgreSQL  
-<code>apt-get install git-core libapache2-mod-php7.0 php7.0-cli php7.0-pgsql php-apcu postgresql-8.4</code> 
- 
-Für die manuelle Installation wird zudem "curl" benötigt. 
- 
-==== Vollautomatisiert mit Ansible und DebOps ==== 
- 
-Siehe hierzu [[https://github.com/debops-contrib/ansible-volkszaehler|debops-contrib.volkszaehler]]. 
- 
- 
-==== Install-Skript (empfohlene Installationsmethode) ==== 
-<code> 
-wget https://raw.github.com/volkszaehler/volkszaehler.org/master/bin/install.sh 
-</code> 
-<code> 
-bash install.sh 
-</code> 
- 
-Das sollte dann ablaufen: 
- 
-<code> 
-pi@raspberrypi:~ $ bash install.sh 
-volkszaehler.org installation script 
- 
-checking prerequisites: php: /usr/bin/php 
- mysql: /usr/bin/mysql 
- awk: /usr/bin/awk 
- sed: /bin/sed 
- grep: /bin/grep 
- wget: /usr/bin/wget 
- mktemp: /bin/mktemp 
- mkdir: /bin/mkdir 
- git: /usr/bin/git 
- 
-checking php version: 7.0.19-1 >= 7.0, ok 
- 
-volkszaehler setup... 
-volkszaehler path? [/home/pi/volkszaehler.org] 
-git clone volkszaehler.org into /home/pi/volkszaehler.org 
-Cloning into '/home/pi/volkszaehler.org'... 
-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/11087), 7.19 MiB | 2.61 MiB/s, done. 
-Resolving deltas: 100% (6085/6085), done. 
-link from webserver to volkszaehler directory? [/var/www/volkszaehler.org] 
-linking /var/www/volkszaehler.org to /home/pi/volkszaehler.org 
- 
-checking composer... 
-/home/pi/volkszaehler.org /home/pi 
-composer not found, downloading... 
-All settings correct for using Composer 
-Downloading... 
- 
-Composer (version 1.5.2) successfully installed to: /var/www/volkszaehler.org/composer.phar 
-Use it: php composer.phar 
- 
-/home/pi 
-composer: /home/pi/volkszaehler.org/composer.phar 
- 
-installing dependencies... 
-/home/pi/volkszaehler.org /home/pi 
-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/debug (v3.3.9): Downloading (100%) 
-  - Installing symfony/polyfill-mbstring (v1.5.0): Downloading (100%) 
-  - Installing symfony/console (v3.3.9): Downloading (100%) 
-  - Installing doctrine/lexer (v1.0.1): Downloading (100%) 
-  - Installing doctrine/inflector (v1.2.0): Downloading (100%) 
-  - Installing doctrine/collections (v1.4.0): Downloading (100%) 
-  - Installing doctrine/cache (v1.6.2): Downloading (100%) 
-  - Installing doctrine/annotations (v1.4.0): Downloading (100%) 
-  - Installing doctrine/common (v2.7.3): Downloading (100%) 
-  - Installing doctrine/dbal (v2.5.13): Downloading (100%) 
-  - Installing andig/dbcopy (dev-master 94a72ce): Cloning 94a72ce582 from cache 
-  - Installing symfony/routing (v3.3.9): Downloading (100%) 
-  - Installing symfony/http-foundation (v3.3.9): Downloading (100%) 
-  - Installing react/promise (v2.5.1): Downloading (100%) 
-  - Installing evenement/evenement (v2.0.0): Downloading (100%) 
-  - Installing react/stream (v0.4.6): Downloading (100%) 
-  - Installing react/event-loop (v0.4.3): Downloading (100%) 
-  - Installing react/socket (v0.5.1): Downloading (100%) 
-  - Installing psr/http-message (1.0.1): Downloading (100%) 
-  - Installing guzzlehttp/psr7 (1.4.2): Downloading (100%) 
-  - Installing ratchet/rfc6455 (v0.2.3): Downloading (100%) 
-  - Installing cboden/ratchet (v0.4): Downloading (100%) 
-  - Installing react/promise-stream (v0.1.1): Downloading (100%) 
-  - Installing ringcentral/psr7 (1.2.1): Downloading (100%) 
-  - Installing react/http (dev-master cd15204): Cloning cd15204bd1 from cache 
-  - Installing paragonie/random_compat (v2.0.11): Downloading (100%) 
-  - Installing monolog/monolog (1.23.0): Downloading (100%) 
-  - Installing react/promise-timer (v1.2.0): Downloading (100%) 
-  - Installing react/cache (v0.4.1): Downloading (100%) 
-  - Installing react/dns (v0.4.11): Downloading (100%) 
-  - Installing react/socket-client (v0.5.3): Downloading (100%) 
-  - Installing symfony/process (v3.3.9): Downloading (100%) 
-  - Installing mkraemer/react-pcntl (v2.0.0): Downloading (100%) 
-  - Installing php-pm/php-pm (dev-master 5a883f4): Cloning 5a883f48f0 from cache 
-  - Installing symfony/event-dispatcher (v3.3.9): Downloading (100%) 
-  - Installing symfony/http-kernel (v3.3.9): Downloading (100%) 
-  - Installing php-pm/httpkernel-adapter (dev-master b373b03): Cloning b373b0384f from cache 
-  - Installing doctrine/instantiator (1.0.5): Downloading (100%) 
-  - Installing doctrine/orm (v2.5.11): Downloading (100%) 
-Writing lock file 
-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. 
-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... 
-/home/pi/volkszaehler.org /home/pi 
-Processing entity "Volkszaehler\Model\Aggregate" 
-Processing entity "Volkszaehler\Model\Entity" 
-Processing entity "Volkszaehler\Model\Channel" 
-Processing entity "Volkszaehler\Model\Data" 
-Processing entity "Volkszaehler\Model\Property" 
-Processing entity "Volkszaehler\Model\Aggregator" 
-Database schema created successfully! 
- 
-Proxy classes generated to "/home/pi/volkszaehler.org/lib/Model/Proxy" 
-/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] 
- 
-</code> 
- 
-Das Script fragt, was es wohin installieren soll. 
- 
- 
-=== Apache unter Debian "Wheezy" konfigurieren === 
-  * mod_rewrite aktivieren: 
-<code> 
-sudo a2enmod rewrite 
-</code> 
- 
-  * Default VirtualHost bearbeiten ( die Datei: "000-default" bearbeiten): 
-<code> 
-sudo nano /etc/apache2/sites-enabled/000-default 
-</code> 
- 
-  * In der Datei, neben: < DocumentRoot > : 
-<code> 
- /var/www/volkszaehler.org/htdocs/ 
-</code> 
-eintragen. 
- 
-  * unter <Directory /var/www/>: (Achtung <Directory> taucht öfter auf.) 
-neben: <AllowOverride> 
-<code> 
-FileInfo Limit Options Indexes Authconfig 
-</code> 
-eintragen. Das "none" wird überschrieben. 
- 
-Die Datei sollte dann so aussehen: 
- 
-<code> 
-<VirtualHost *:80> 
-        ServerAdmin webmaster@localhost 
- 
-        DocumentRoot /var/www/volkszaehler.org/htdocs/ 
-        <Directory /> 
-                Options FollowSymLinks 
-                AllowOverride None 
-        </Directory> 
-        <Directory /var/www/> 
-                Options Indexes FollowSymLinks MultiViews 
-                AllowOverride FileInfo Limit Options Indexes AuthConfig 
-                Order allow,deny 
-                allow from all 
-        </Directory> 
- 
-        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ 
-        <Directory "/usr/lib/cgi-bin"> 
-                AllowOverride None 
-                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch 
-                Order allow,deny 
-                Allow from all 
-        </Directory> 
- 
-        ErrorLog ${APACHE_LOG_DIR}/error.log 
- 
-        # Possible values include: debug, info, notice, warn, error, crit, 
-        # alert, emerg. 
-        LogLevel warn 
- 
-        CustomLog ${APACHE_LOG_DIR}/access.log combined 
-</VirtualHost> 
-</code> 
- 
-=== Apache unter Debian "Jessie" und "Stretch" konfigurieren === 
-  * mod_rewrite aktivieren: 
-<code> 
-sudo a2enmod rewrite 
-</code> 
- 
-  * Default VirtualHost bearbeiten ( die Datei: "000-default.conf" bearbeiten): 
-<code> 
-sudo nano /etc/apache2/sites-enabled/000-default.conf 
-</code> 
- 
-  * In der Datei, neben: < DocumentRoot > : 
-<code> 
- /var/www/volkszaehler.org/htdocs/ 
-</code> 
-eintragen. 
- 
-Nach dem editieren und abspeichern der Datei: 
-<code> 
- sudo systemctl restart apache2 
-</code> 
-ausführen. 
- 
-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: 
-<code> 
-git clone git://github.com/volkszaehler/volkszaehler.org.git ~/volkszaehler.org 
-sudo ln -sf ~/volkszaehler.org /var/www/volkszaehler.org 
-sudo chown -R www-data /var/www/volkszaehler.org 
-</code> 
- 
-=== Apache konfigurieren === 
-  * mod_rewrite aktivieren: 
-<code> 
-sudo a2enmod rewrite 
-</code> 
- 
-  * Default VirtualHost bearbeiten: 
-<code> 
-/etc/apache2/sites-enabled/000-default: 
-    DocumentRoot /var/www/volkszaehler.org/htdocs/ 
-</code> 
- 
-  * unter <Directory /var/www/>: 
-<code> 
-AllowOverride FileInfo Limit Options Indexes Authconfig 
-</code> 
- 
-=== Alternativ: nginx konfigurieren === 
-<code> 
-server { 
-        listen 80; 
-        listen [::]:80; 
-        server_name volkszaehler.org; 
- 
-        root /var/www/volkszaehler.org/htdocs; 
- 
-        index index.php index.html; 
- 
-        location / { 
-                try_files $uri $uri/ =404; 
-        } 
-        location ~ \.php { 
-                include snippets/fastcgi-php.conf; 
-        #       # With php5-cgi alone: 
-        #       fastcgi_pass 127.0.0.1:9000; 
-                # With php5-fpm: 
-                fastcgi_pass unix:/var/run/php5-fpm.sock; 
-        } 
-} 
-</code> 
- 
-Wichtig ist dass in der config in der Zeile "location ~ \.php {" kein $-Zeichen hinter dem PHP steht. Siehe [[http://volkszaehler.org/pipermail/volkszaehler-dev/2011-June/000925.html|Mail Archiv]] 
- 
- 
-=== Installation der benötigten Module === 
- 
-== Zunächst PHP Paketmanager Composer von getcomposer.org installieren == 
- 
-<code> 
-cd /tmp 
-curl -sS https://getcomposer.org/installer | php 
-sudo mv composer.phar /usr/local/bin/composer 
-sudo chmod +x /usr/local/bin/composer 
-</code> 
- 
-== Ahängigkeiten laden und installieren (v.a. Doctrine) == 
- 
-<code> 
-cd /var/www/volkszaehler.org/ # Anmerkung: ansonsten wird die Datei "composer.json" nicht gefunden; Fehlermeldung: "Composer could not find a composer.json file..." 
-composer install 
-</code> 
- 
-=== Konfiguration der Middleware === 
-<code> 
-cd /var/www/volkszaehler.org/etc/ 
-cp volkszaehler.conf.template.php volkszaehler.conf.php 
-edit volkszaehler.conf.php: 
-    $config['db']['host'              = 'localhost'; 
-    $config['db']['user'              = 'vz'; 
-    $config['db']['password'          = '<shhh!>'; 
-    $config['db']['dbname'            = 'volkszaehler'; 
-</code> 
- 
-Alternativ wird die Installation in der [[http://www.doctrine-project.org/documentation/manual/2_0/en/introduction#installing|Doctrine Dokumentation]] beschrieben. Falls du also Probleme bei der Installation haben solltest, kannst du dir hier noch ein paar Informationen holen. 
- 
-=== Datenbank konfigurieren === 
-  * Datenbank-User anlegen: 
- 
-<code> 
-phpmyadmin: 
-    Home -> "Rechte" -> "Neuen Benutzer hinzufügen" 
-        Benutzername: vz 
-        Host: localhost 
-        Passwort: <shhh!> 
-        keine globalen Rechte vergeben! 
-        -> ok 
-oder: 
-    CREATE USER 'vz'@'localhost' IDENTIFIED BY '<shhhh!>'; 
-</code> 
- 
-  * Datenbank anlegen: 
-<code> 
-phpmyadmin 
-    Home -> "Datenbank anlegen", Name: "volkszaehler" -> "Anlegen" 
-oder: 
-    CREATE DATABASE `volkszaehler`; 
-</code> 
- 
-  * Tabellen anlegen: 
-<code> 
-# cd /var/www/volkszaehler.org/ 
-# php bin/doctrine orm:schema-tool:create 
-ATTENTION: This operation should not be executed in a production environment. 
- 
-Creating database schema... 
-Database schema created successfully! 
-</code> 
- 
-  * Demoinhalte importieren: 
-<code> 
-      Tabelle "entities" auswählen (unbedingt zuerst diese importieren!) 
-      "Importieren"; das Gleiche mit "properties" und "data" 
-</code> 
-oder: 
-<code> 
-      cd /var/www/volkszaehler.org/misc/sql 
-      cat entities.sql properties.sql data-demoset1.sql | mysql -uroot volkszaehler -p 
-</code> 
- 
-  * Rechte setzen: 
-<code> 
- 
-Datenbank "mysql", Tabelle "tables_priv": 
-    "Einfügen":  
-        Host: "localhost" 
-        Db: "volkszaehler" 
-        User: "vz" 
-        Table_name: "data" (anschließend das Gleiche mit "entities", "entities_in_aggregator", "properties", "tokens" 
-        Table_priv: "select", "update" und "insert" 
-         
-oder: 
-        GRANT select, update, insert ON volkszaehler.* TO vz@localhost; 
-</code> 
- 
-  * Nun noch ein Passwort für den mysql-Administrator "root" setzen und die Passwortdatenbank aktivieren: 
-<code> 
-mysqladmin password -u root "<neues, gutes passwort>" 
-mysqladmin reload -p 
-</code> 
- 
-===== 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 [[/howto/git]]. 
- 
- 
-===== phpMyAdmin installieren ===== 
-<note important>Für Vollzugriff auf die Volkszählerdatenbank über phpMyAdmin haben wir den User ''vz-admin''. Standardpasswort: ''secure''</note> 
-MySQL-Superuser ist: ''root'' und das Standardpasswort: ''raspberry''\\ 
-phpMyAdmin-Superuser ist: ''phpmyadmin'' und das Standardpasswort: ''raspberry'' 
- 
-==== Debian Stretch ==== 
-<code>sudo apt-get install phpmyadmin</code> 
-Nach Installation der nötigen Pakete wird das Konfigurationsscript gestartet. Es konfiguriert Apache und fragt nach einem Passwort für den neu anzulegenden User ''phpmyadmin''. 
-<note warning>Wenn kein Passwort vergeben wird kann das Fehlfunktionen zur Folge haben</note> 
-Auch Apache wird automatisch neu gestartet. 
-<note important>Unter Stretch kann man sich in MySQL nur als ''root'' anmelden wenn man lokal als root agiert (''sudo'').\\ Von und für phpMyAdmin ist deswegen der User ''phpmyadmin'' angelegt worden.</note> 
-Um dem neuen User volle Adminrechte zu gewähren: 
-<code>sudo mysql -uroot -praspberry --execute "grant all privileges on *.* to 'phpmyadmin'@'localhost' with grant option"</code> 
- 
-==== Debian Jessie ==== 
-<code>sudo apt-get install phpmyadmin</code> 
-<code>sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/sites-enabled/phpmyadmin.conf</code> 
-<code>sudo systemctl restart apache2</code> 
- 
-==== Debian Wheezy ==== 
-<code>sudo apt-get install phpmyadmin</code> 
-<code>sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf.d/phpmyadmin.conf</code> 
-<code>sudo /etc/init.d/apache2 reload</code> 
  
software/middleware/installation.txt · Zuletzt geändert: 2023/03/27 21:14 von joha