Background

At nearly all my recent engagements, clients have needed a means to collabarate, document and publish information across the organziation. Specifically, the information needed to be easily accessible, secure and configurable. In some instances, the client purchased expensive out of the box content management systems while others preferred using open source options. Each system offerred its own set of benefits and drawbacks.

Challenge

In my research, I encountered a myriad of products which satifisfied the client's requirement to identify software that provided the ability to collaborate and document the organization's information. To my amazement, the number of options available were overwhelming, each claiming to provide features and benefits over others. My challenge became not in finding software which accomplished their need rather in sifting through the mountains of options available.

During my analysis, I realized most organizations had a common list of wants for their new collaborative software. Many listed the following attributes to be the most important when making the proper selection:

  1. Ease of Use: The solution needs to be easy to use, upgrade and manage.
  2. Cost: The software should ideally be open source and/or come at a minimal cost.
  3. Support: The software must provide proper documentation.
  4. Flexibility: The product needs to be flexible and pluggable to accommodate the organization's changing data/documentation needs.
  5. Active Development: The product must be in active development and have regular interval releases.

Solution

The solution, as you can guess from the title of this blog, was DokuWiki. DokuWiki satisfied and fulfilled all of the client's identified needs. It claimed to be very easy to use, was open source, provided the ability to add plugins, was actively developed and had a large user community. It also provided all the major features of a wiki including the ability to upload documents, spam protection, page access control (security), ability to customize, inline HTML and document renaming. In addition, it supported the ability to create web feeds, was extensible via plugins, and provided cross WIKI support.

Environment

For this tutorial, we'll be installing DokuWiki on Red Hat's Fedora Linux operating system running Apache 2 web server.

DokuWiki Requirements

DokuWiki has a minimal set of requirements including

  1. A webserver which supports PHP
  2. PHP 5.12 or higher installed on the webserver
  3. A current browser

Note: Most people run DokuWiki on Apache but IIS, Nginx and lighttpd have been noted to work.

Installing DokuWiki

Install DokuWiki manually not with apt-get. Since it uses text files to store information, there is no need to install a database. Installation is as simple as downloading the required files, extracting them and modifying some file permissions.

  1. Download the latest release from http://www.splitbrain.org/Programming/PHP/DokuWiki/index.php.
  2. Open a terminal and issue the following commands:
$ cd /var/www
$ tar -xzvf /path/to/your/download/dokuwiki-YYYY-MM-DD.tgz
  1. You should see the terminal extract the files from the compressed package.
  2. Do a list command to confirm your new directory exists:
$ ls
  1. In the list you should see a directory named dokuwiki-YYYY-MM-DD.
  2. You can rename the directory, lets call it wiki:
$ mv dokuwiki-YYYY-MM-DD wiki
  1. Finally create a changes.log file which is required for Dokuwiki to function. Using the touch command willl create an empty file called changes.log.
$ touch wiki/data/changes.log

Important Directories

We want to note a couple important directories used by the wiki.

  1. Installation directory
/var/www/wiki
  1. Data directory
/var/lib/dokuwiki

First Time Access

We need to modify some permissions before the wiki can be accessible. Fortunately for us, DokuWiki provides a nice screen detailing any permission issues.

  1. Access your server at http://localhost/wiki/install.php.
  2. You should see a screen with an attempt to load dokuwiki.
    • You may have some errors on the screen which can be resolved by giving permission to the files that require access. The error(s) on the screen show you what files are affected.

Permissions

  1. Navigate to the wiki root directory.
cd /var/www/wiki
  1. Change all the wiki sub-folders recursively so www-data is the owner and group.
chown -R www-data wiki
chgrp -R www-data wiki
  1. Ensure all the subdirectories were properly changed.
-rw-r--r-- 1 www-data www-data 10676 Feb 14 2009 feed.php
-rw-r--r-- 1 www-data www-data 2206 Feb 14 2009 doku.php
drwxr-xr-x 2 www-data www-data 4096 Feb 14 2009 bin
-rw-r--r-- 1 www-data www-data 240 Feb 14 2009 README
-rw-r--r-- 1 www-data www-data 17992 Feb 14 2009 COPYING
-rw-r--r-- 1 www-data www-data 1470 Feb 14 2009 .htaccess.dist
-rw-r--r-- 1 www-data www-data 16072 Feb 14 2009 install.php
-rw-r--r-- 1 www-data www-data 185 Feb 14 2009 index.php
drwxr-xr-x 8 www-data www-data 4096 Feb 14 2009 lib
-rw-r--r-- 1 www-data www-data 12 May 26 14:56 VERSION
drwxr-xr-x 7 www-data www-data 4096 May 26 14:56 .
drwxr-xr-x 6 www-data www-data 4096 May 26 14:57 inc
drwxr-xr-x 6 root root 4096 Aug 15 17:17 ..
drwxr-xr-x 10 www-data www-data 4096 Aug 15 17:17 data
drwxr-xr-x 2 www-data www-data 4096 Aug 15 17:31 conf

Migrating Data to a New Server or Installation

As previously mentioned, DokuWiki uses flat files to store the data. Migrating data to a new installation is as simple as moving the data directories to the new server WIKI directory.

  1. Navigate (cd) to the new DokuWiki data directory
  2. Remove all the data (in this case move) to the /tmp folder. Moving to tmp means they will be deleted on next reboot, but you can still retrieve data before reboot if you goof up.
$ mv /var/lib/dokuwiki /tmp
  1. Copy the data directory from the old location to the new location.
$ cp -av /path/to/old/machine/var/lib/dokuwiki /var/lib/
  1. Login to newly populated wiki and administratively install all plugins that you had before.

Allowing Additional Upload File Types

  1. Create a file called mime.local.conf in the dokuwiki/conf folder.
  2. Add mime-types to the file (! means mp3 will NOT be allowed for upload).
mp3 !audio/mpeg
avi video/x-msvideo
mpg video/mpeg
mpeg video/mpeg
  1. Ensure permissions for mime.local.conf is set to 744

Increasing Max Upload File Size

  • The file upload size is set in your PHP configuration, php.ini, with the parameter upload_max_filesize.
  • The setting can be changed in a number of different places depending on your webserver and the method it uses to run PHP.
  • For Apache & mod_php, add the following two lines to .htaccess in the installed directory:
php_value upload_max_filesize 15M
php_value post_max_size 15M

Note: Red Hat ES users will also want to check (and probably increase) LimitRequestBody in /etc/httpd/conf.d/php.conf, which is set by default to a fairly low value. This directive specifies the number of bytes from 0 (meaning unlimited) to 2147483647 (2GB) that are allowed in a request body.

Additional Help

For additional help, you can visit the following websites for information about DokuWiki: