Ubuntu 16.10: Install DokuWiki for wiki software

This article will describe installing DokuWiki.

1 Install DokuWiki

  • This article uses default SSL/TLS certicication file for https. Please change your SSL/TLS certification file.
  • If you use http instead of https, change 443 to 80 and delete SSLXXX directive in /etc/httpd/conf.d/dokuwiki.conf.
#!/bin/sh

set -e

[ -z "${DOKUWIKI_PASSWD}" ] && DOKUWIKI_PASSWD=dokuwiki

dokuwiki_install()
{
  cat <<EOF | sudo debconf-set-selections
dokuwiki dokuwiki/wiki/password password ${DOKUWIKI_PASSWD}
dokuwiki dokuwiki/wiki/confirm password ${DOKUWIKI_PASSWD}
dokuwiki dokuwiki/system/purgepages boolean false
EOF

  sudo apt install -y dokuwiki
}

apache_install()
{
  sudo apt install -y apache2 libapache2-mod-php7.0 php7.0-xml php7.0-mbstring

  sudo chown -R www-data:www-data /usr/share/dokuwiki

  cat <<EOF | sudo tee /etc/apache2/sites-available/dokuwiki.conf
<VirtualHost _default_:443>
  SSLEngine on
  SSLCertificateFile    /etc/ssl/certs/ssl-cert-snakeoil.pem
  SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

  Alias /dokuwiki /usr/share/dokuwiki

  <Directory /usr/share/dokuwiki>
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>
EOF

  sudo a2enmod ssl
  sudo a2enmod php7.0
  sudo a2ensite dokuwiki
  sudo systemctl enable apache2
  sudo systemctl restart apache2
}

dokuwiki_main()
{
  dokuwiki_install
  apache_install
}

dokuwiki_main

2 Access to DokuWiki

Access to the following URL. Accept this page's certification to browser.

https://<server>/dokuwiki

DokuWiki page is displayed. Login to DokuWiki with inputing admin to user and DOKUWIKI_PASSWD value to password.

0001_DokuWiki.png