User Tools

Site Tools


install_dokuwiki

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
install_dokuwiki [2019/01/30 10:09] – created msvoelkerinstall_dokuwiki [2024/04/24 12:27] (current) – msvoelker
Line 1: Line 1:
 ====== Install DokuWiki ====== ====== Install DokuWiki ======
  
-A FreeBSD 11.2-RELEASE was installed on a PCEngines box to host a DokuWiki server. To install and configure DokuWiki, the following steps were perfored.+A FreeBSD 14.0-RELEASE was installed on a PCEngines box to host a DokuWiki server. 
 + 
 +===== Install and configure DokuWiki =====
  
 Install DokuWiki and Apache. Install DokuWiki and Apache.
-  sudo pkg install dokuwiki+  sudo pkg install dokuwiki-php82
   sudo pkg install apache24   sudo pkg install apache24
  
Line 13: Line 15:
   #DocumentRoot "/usr/local/www/apache24/data"   #DocumentRoot "/usr/local/www/apache24/data"
   DocumentRoot "/usr/local/www/dokuwiki"   DocumentRoot "/usr/local/www/dokuwiki"
-  +
   <Directory "/usr/local/www/dokuwiki">   <Directory "/usr/local/www/dokuwiki">
-  Options Indexes FollowSymLinks +        Options Indexes FollowSymLinks 
-   DirectoryIndex index.php +        DirectoryIndex index.php 
-   AllowOverride None +        AllowOverride None 
-   Require all granted+        Require all granted
   </Directory>   </Directory>
  
 Install PHP module Install PHP module
-  sudo pkg install mod_php71+  sudo pkg install mod_php82
  
 check if the LoadModule line was added check if the LoadModule line was added
Line 28: Line 30:
  
 should output should output
-  LoadModule php7_module        libexec/apache24/libphp7.so+  LoadModule php_module         libexec/apache24/libphp.so
  
 add in /usr/local/etc/apache24/httpd.conf add in /usr/local/etc/apache24/httpd.conf
-  <IfModule php7_module>+  <IfModule php_module>
           DirectoryIndex index.php index.html           DirectoryIndex index.php index.html
           AddType application/x-httpd-php .php           AddType application/x-httpd-php .php
Line 43: Line 45:
 restart FreeBSD restart FreeBSD
  
-open wiki install.php in browser+For a initial config, open wiki install.php in browser
   http://192.168.178.65/install.php   http://192.168.178.65/install.php
  
Line 55: Line 57:
 after that /usr/local/www/dokuwiki/conf/local.php contains the configuration after that /usr/local/www/dokuwiki/conf/local.php contains the configuration
  
-create directory outside of the installation path+It is recommended to separate config and binaries from DokuWiki website files. Create a directory outside of the installation path
   sudo mkdir -p /var/dokuwiki/www   sudo mkdir -p /var/dokuwiki/www
  
Line 63: Line 65:
   sudo mv /usr/local/www/dokuwiki/bin /var/dokuwiki/   sudo mv /usr/local/www/dokuwiki/bin /var/dokuwiki/
  
-set owner of /var/dokuwiki/www to www+It is important that the www user (the user that runs apache) has access to these files --> set owner of /var/dokuwiki/www to www
   sudo chown -R www:www /var/dokuwiki/www   sudo chown -R www:www /var/dokuwiki/www
  
-create inc/preload.php+DokuWiki needs to know where to find these files. Create inc/preload.php
   sudo vi /usr/local/www/dokuwiki/inc/preload.php   sudo vi /usr/local/www/dokuwiki/inc/preload.php
  
-and add +and add
   <?php   <?php
   // DO NOT use a closing php tag. This causes a problem with the feeds,   // DO NOT use a closing php tag. This causes a problem with the feeds,
   // among other things. For more information on this issue, please see:w   // among other things. For more information on this issue, please see:w
-  // http://www.dokuwiki.org/devel:coding_style#php_closing_tags +  // http://www.dokuwiki.org/devel:coding_style#php_closing_tags
   define('DOKU_CONF','/var/dokuwiki/www/conf/');   define('DOKU_CONF','/var/dokuwiki/www/conf/');
  
Line 79: Line 81:
   $conf['savedir'] = '/var/dokuwiki/www/data';   $conf['savedir'] = '/var/dokuwiki/www/data';
  
-Backup +===== Use https ===== 
-tar czf dokuwiki_`date +"%Y%m%d"`.tar.gz --exclude data/cache --exclude data/index --exclude data/locks --exclude data/tmp /var/dokuwiki/www + 
-save on Apple Time Capsule? +The server needs a certificate to provide https access. If a certificate in a .p12 file format exist, convert it into a .pem file. 
-Notification on error?+ 
 +  openssl pkcs12 -in certificate.p12 -out certificate.pem -nodes 
 + 
 +Copy the .pem file in a .crt and .key file 
 + 
 +  cp certificate.pem certificate.crt 
 +  cp certificate.pem certificate.key 
 + 
 +The .crt file should contain the public certificate only. Edit the file and remove everything except the following Block. 
 + 
 +<code> 
 +-----BEGIN CERTIFICATE----- 
 +... 
 +-----END CERTIFICATE----- 
 +</code> 
 + 
 +The .key file should contain the private key only. Edit the file and remove everything except the following Block. 
 + 
 +<code> 
 +-----BEGIN PRIVATE KEY----- 
 +... 
 +-----END PRIVATE KEY----- 
 +</code> 
 + 
 +Copy both files to /usr/local/etc/apache24/ssl/ 
 + 
 +  mkdir /usr/local/etc/apache24/ssl 
 +  cp certificate.crt /usr/local/etc/apache24/ssl/ 
 +  cp certificate.key /usr/local/etc/apache24/ssl/ 
 + 
 +Configure apache for SSL access. In /usr/local/etc/apache24/httpd.conf 
 + 
 +Uncomment the line 
 + 
 +  LoadModule ssl_module libexec/apache24/mod_ssl.so 
 + 
 +Add 
 + 
 +  <IfModule ssl_module> 
 +  SSLRandomSeed startup builtin 
 +  SSLRandomSeed connect builtin 
 +  </IfModule> 
 + 
 +and add 
 + 
 +  ServerName nplab.fh-muenster.de:443 
 +  SSLEngine on 
 +  SSLCertificateFile "/usr/local/etc/apache24/ssl/certificate.crt" 
 +  SSLCertificateKeyFile "/usr/local/etc/apache24/ssl/certificate.key" 
 + 
 +To apply these changes, restart Apache serivce 
 + 
 +  sudo service apache24 restart 
 + 
 +On error, check /var/log/httpd-error.log for log messages. 
 + 
 +===== Impressum im Footer ===== 
 + 
 +In /var/dokuwiki/www/conf/footer.html lässt sich HTML-Code schreiben, der im Footer auf jeder Seite des Wikis angezeigt wird. Hinzugefügt wurde ein einfacher Link zu einem Impressum. 
 + 
 +  <a href="/doku.php?id=public:impressum" class="wikilink1" title="public:impressum" data-wiki-id="public:impressum">Impressum</a> 
 + 
 +Der Link verweist auf eine normale Wiki-Seite, die ggf. mit beliebigen Text gefüllt werden kann. 
 + 
 +===== Backup ===== 
 + 
 +For a automatic backup, the DokuWiki files are compressed in a tar.gz archive and copied to another server (bsd19.fh-muenster.de (console)). This is done by 
 +a separate user named wikibackup. 
 +   
 +Create user wikibackup on source and destination system (nplab.fh-muenster.de and bsd19.fh-muenster.de). 
 +   
 +  adduser 
 + 
 +  * Username: wikibackup 
 +  * Do not add the user in any group 
 +  * Shell: nologin 
 +  * Use password-based authentication?: no 
 + 
 +wikibackup@nplab.fh-muenster.de needs to ssh to bsd19.fh-muenster.de without entering a password. On nplab.fh-muenster.de, switch to user wikibackup and crea 
 +te SSH keys. 
 +   
 +  sudo su - wikibackup 
 +  ssh-keygen 
 + 
 +Copy the content of ~/.ssh.id_rsa.pub into ~/.ssh/authorized_keys on wikibackup@bsd19.fh-muenster.de. After that, on nplab.fh-muenster.de as wikibackup 
 + 
 +  ssh bsd19.fh-muenster.de 
 +   
 +should work without entering a password. 
 + 
 +Next step is to create the script that performs the backup and copies the backup file to bsd19.fh-muenster.de.  The following script (~/backup.sh) is used. 
 +   
 +<code> 
 +#!/bin/sh 
 +   
 +echo $(date) 
 + 
 +dayOfYear=$(date +%j) 
 +file=~/wiki-$dayOfYear.tar.gz 
 + 
 +echo backup wiki to $file 
 +tar -czf $file -C /var/dokuwiki/ --exclude www/data/cache --exclude www/data/index --exclude www/data/locks --exclude www/data/tmp --exclude www/data/dont-pa 
 +nic-if\* www 
 + 
 +echo copy to bsd19 and delete local file 
 +scp $file bsd19.fh-muenster.de:~/ 
 +rm $file 
 + 
 +echo done 
 +</code> 
 + 
 +To start the script daily, create a cron job. On nplab.fh-muenster.de as wikibackup, run 
 + 
 +  crontab -e 
 + 
 +and add 
 + 
 +<code> 
 +SHELL=/bin/sh 
 +PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin 
 +# Order of crontab fields 
 +# minute        hour    mday    month   wday    command 
 +  0             22      *       *       *       /bin/sh /usr/home/wikibackup/backup.sh > /usr/home/wikibackup/backup.log 2>&1 
 +</code> 
 + 
 + 
install_dokuwiki.1548842967.txt.gz · Last modified: by msvoelker