Back to OP5 Monitor FAQ

How to install DokuWiki stand-alone on Centos 8

Unsupported Copied

This article is provided as a guide on how a stand-alone installation of DokuWiki could be performed. DokuWiki is not officially supported by ITRS.

Expectations Copied

Install Apache and PHP Copied

# dnf update -y
# dnf install httpd -y
# dnf install php php-common php-pecl-apcu php-cli php-pear php-pdo php-mysqlnd
## php-pgsql php-gd php-mbstring php-xml -y
# dnf install php-{spl,hash,ctype,json,mbstring,zip,gd,curl,xml,common,ldap} -y

Not all of these packages may be strictly required, but they may be useful in the future.

If you have firewall-cmd enabled on the system, open the relevant ports (standard HTTP and HTTPS in this example). This also goes for any potential external firewalls in your network.

## firewall-cmd --add-port=80/tcp --zone=public --permanent
## firewall-cmd --add-port=443/tcp --zone=public --permanent
## firewall-cmd --reload

Install DokuWiki Copied

Download the latest stable version of DokuWiki to tmp:

# cd /tmp && curl -O https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz

Unpack into the html root and change ownership to apache:

## tar xzf dokuwiki-stable.tgz --strip-components=1 -C /var/www/html/
## chown apache:apache -R /var/www/html

Set up a VirtualHost with Apache. This will also deny access to some subdirectories:

/etc/httpd/conf.d/dokuwiki.conf:
<VirtualHost *>
ServerName your_servername
DocumentRoot /var/www/html
<Directory ~ "/var/www/html/(bin/|conf/|data/|inc/|vendor/)">
<IfModule mod_authz_core.c>
Require all denied
Order allow,deny Deny from all

ErrorLog /var/log/httpd/dokuwiki_error.log CustomLog /var/log/httpd/dokuwiki_access.log combined

After a httpd restart, you will probably get the initial error telling you to run the installer:

The datadir (‘pages’) at ./data/pages is not found, isn’t accessible or writable. You should check your config and permission settings. Or maybe you want to run the installer?

First, try to access things that shouldn’t be public so we know this is blocked:

http://yourserver/data/pages/wiki/dokuwiki.txt

Should give:

You don’t have permission to access /data/pages/wiki/dokuwiki.txt on this server.

dokuwiki_error.log will say something like:

AH01630: client denied by server configuration: /var/www/html/data/pages/wiki/dokuwiki.txt

You may want to monitor log lines like this but this is beyond the scope of this article.

Disable selinux: making dokuwiki work with selinux enabled is also beyond the scope of this article:

## setenforce 0
# sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/sysconfig/selinux
# sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config

Now proceed to the installation:

http://yourserver/install.php

By setting ACL policy to “Closed Wiki”, your wiki will only be accessible to read or write for logged in users. You may want to uncheck the “anonymous usage data” checkbox before clicking Save.

When you have saved your initial settings and the installer prompts you, delete install.php from your server.

Users and passwords are stored in conf/users.auth.php – this is the default “Plain Text Authentication Backend”. You can easily add more users by going to “Admin” in the top right, then “User Manager”.

You may use other authentication modules, such as AD/LDAP/MySQL etc. These are already bundled with the installation.

Documentation for these modules is available here.

Migrate existing content Copied

See: How to move DokuWiki from one Server to another?

If you have a working setup as per the above settings, you may want to back up your current DokuWiki directory before making potentially breaking changes:

## tar czvf /var/www/html_backup.tgz /var/www/html/

Your content pages should be available as simple txt files here, and can most likely be moved separately if you do not wish to migrate everything:

## find /var/www/html/data/pages/ | grep txt

Please note that the pages themselves do not contain metadata (changes etc.), media files and so on, this can be found in other directories under the “data” directory.

The page structure in newer versions (namespaces) looks something like this:

(...)/doku.php?id=host:monitor

For a file like:

/var/www/html/data/pages/host/monitor.txt

The same hierarchy may look like this on older versions of DokuWiki bundled with Monitor:

(...)/dokuwiki/doku.php/host/monitor

Which is often expressed with macros as:

(...)/dokuwiki/doku.php/host/$HOSTNAME$

You will likely need to update notes_url values accordingly to point to your new installation.

["Geneos"] ["FAQ"]

Was this topic helpful?