User Tools

Site Tools


Sidebar

tutorials:dokuwiki

This is an old revision of the document!


= DokuWiki Installation and Configuration =

DokuWiki is one of the most popular wiki implementations. I'm using it right now to write this tutorial. DokuWiki is a lightweight implementation possessing a of features which I find very useful and convenient: * it is file-based (no database required); * installation and configuration is a breeze, especially for a manual installation (grabbing the source code, unzip and configure); * it uses a namespace-based structure, allowing for easy organization of information; * its community develops a lot of useful plugins; * it is, in my opinion, very usable: the interface, the editing features, information organization, overall view are intuitive and allow for rapid editing without little loss of time.

That being said, let's move on to the requirements and installation steps.

User Requirements

DokuWiki is highly configurable and customizable and I'm going to define the features that are to be used by a wiki installation. These are the features I'm usually going for when doing a DokuWiki installation, such as this one: * The wiki is to be installed by a non-priviliged users using their own “user directory” (such as public_html}). * The wiki is public: everyone can read its contents and only certain users may edit it, after logging in (through the use of ACLs). * Create index pages for easy access to information. This is achieved with the help of the indexmenu plugin. My wiki's start page or index page are index pages deployed with the help the indexmenu plugin. * The wiki will use “pretty” slash-separated URL. It will use dokuwiki} instead of doku.php}. * The wiki will enable Creole markup, through the use of the creole plugin. * The wiki will define a contrib} namespace that is world-writable. * The wiki will define an internal} namespace that is readable/writable only by authenticated users. * The wiki enables HTTPS-access to login/logout and admin pages (but HTTP access for normal ones). * The wiki enables LDAP authentication (optional - one must have access to a LDAP service).

Install and Upgrade Scripts

* Mircea Bardac and me have created a set of scripts for installation, configuration and upgrade of DokuWiki. These scripts provide solutions to most of the above user_requirements. The scripts are part of the admin Git repository storing a variety of administrative scripts. * Issue the following command to get a copy of the repository

git clone http://koala.cs.pub.ro/git/admin-public.git

* Browse to the dokuwiki} subfolder. Please go through the readme} file for a description of each file.

Basic Installation and Configuration

Using the Install Scripts

These instructions are also present in the readme} file in the dokuwiki} folder in the repository.

# Find the desired DokuWiki version for download. Use this download URL. # Run the install install_dokuwiki} script. It requires three arguments: ## the installation folder for dokuwiki}; it must exist; (dokuwiki2} in the sample run) ## the DokuWiki tarball download URL; (dokuwiki-2009-12-25.tgz} - the latest stable version - in the sample run) ## the future DokuWiki URL. (wiki2} in the sample run) #* Sample run:

so@elf:~/dokuwiki$ ./install_dokuwiki  ~/public_html/dokuwiki2/ http://www.splitbrain.org/_media/projects/dokuwiki/dokuwiki-2009-12-25.tgz http://elf.cs.pub.ro/so/wiki2/
* Using download link http://www.splitbrain.org/_media/projects/dokuwiki/dokuwiki-2009-12-25.tgz
  * Downloading DokuWiki ...  done.
* Preparing installation folder /home/so/public_html/dokuwiki2/ ... done.
* Installing plugins
  * Installing plugin: Creole ... done.
  * Installing plugin: Google Analytics ... done.
  * Installing plugin: Include ... done.
  * Installing plugin: Index-Menu ... done.
  * Installing plugin: Display-Wiki-Page ...done.


Installation complete.
1. Open in web browser: http://elf.cs.pub.ro/so/wiki2/install.php
2. After the install procedure run:
   ./post_install_dokuwiki /home/so/public_html/dokuwiki2/ /so/wiki2/

Now you're done.

# Open install URL (as mentioned in step 1 of the post-install message) and configure DokuWiki instance. #* The web configuration interface is quite intuitive. #* You will probably go for a public wiki (read access for everyone, and write access for registered users). # Run the post_install_dokuwiki} script (as mentioned in step 2 of the post-install message). #* The script creates a htaccesss} file in DokuWiki's installation folder and prints out other configuration options you should do. # The htaccess} file contains Apache2 mod_rewrite rules for pretty slash-based URLs. #* Sample run:<code> so@elf:~/dokuwiki$ ./post_install_dokuwiki /home/so/public_html/dokuwiki2/ /so/wiki2/ Add to '/home/so/public_html/dokuwiki2/conf/local.php' the following lines (use the web interface in case you don't have enough rights): $conf['start'] = 'home'; $conf['youarehere'] = 1; $conf['sneaky_index'] = 1; $conf['userewrite'] = '1'; $conf['securecookie'] = 0; $conf['useslash'] = 1; $conf['sepchar'] = '-'; $conf['plugin']['creole']['precedence'] = 'creole'; $conf['plugin']['indexmenu']['page_index'] = 'home:index'; $conf['plugin']['indexmenu']['skip_index'] = '/(home|playground)/'; $conf['plugin']['indexmenu']['skip_file'] = '/^:home:index.txt$/'; Add to the beginning of '/home/so/public_html/dokuwiki2/.htaccess' (after 'RewriteEngine on') the following lines (in case you want to enable HTTPS access to login and admin pages): # Switch to secure on login, profile and admin actions RewriteCond %{HTTPS} !on RewriteCond %{QUERY_STRING} do=(log|profile|admin) RewriteRule ^(.*) https://%{HTTP_HOST}/so/wiki2/$1 [R,QSA,L] # Change back to non-secure on show action RewriteCond %{HTTPS} on RewriteCond %{QUERY_STRING} (do=show|^$) RewriteCond %{REQUEST_METHOD} GET RewriteRule ^(.*) http://%{HTTP_HOST}/so/wiki2/$1 [R,QSA,L] </code> # Add local.php} configurations as mentioned in previous output. #* The reason they are not added automatically is the current user may not have access to the local.php} file (as it is created by the web server through the www-data} user). #* In case of no rights (the www-data} user creates the file) use DokuWiki's web administrative interface: login, use the admin} button and then the configuration_settings} link. You should have no problem identifying the required web interface directives. # Congratulations! You've got a basic DokuWiki installation with pretty slash based URLs and Creole markup. === indexmenu Configuration === The indexmenu plugin is installed but the index pages are not yet created. As written in the local.php} file, we will use index} as the index page:<code> $conf['plugin']['indexmenu']['page_index'] = 'home:index'; </code> At the same time we will create and index menu on the start/home page. You'll need to go through the following steps (mentioned in the readme} file): # Type index} in DokuWiki's search bar and create the page. For index display I usually add the following syntax:<code>

</code> #* Each time you will use the index} button in the bottom right corner the index menu in the index} page is displayed. # Add an index menu to the first page in the wiki (home). Just type home} in DokuWiki's search bar and create/edit the page. I usually fill it with something like:<code> = Wiki Name =

</code> #* wiki_name} is the name of the wiki. It gets displayed as a heading 1 title. # You can add indexes to namespaces (edit the home} page):<code> = Namespace Name ==

</code> == Advanced Configuration == === HTTPS Access === * In case you want HTTPS access, add the configuration lines mentioned in the output message of the post_install_dokuwiki} script to the htaccess} file in DokuWiki's installation folder. * Make sure you add them after the rewriteengine_on} line and _before_ the other mod_rewrite lines (used for pretty URLs). === LDAP Authentication === * The official LDAP Authentication page contains important information regarding the configuration of LDAP authentication. * The dokuwiki/samples/dokuwiki-ldap-auth-swarm.conf contains a configuration sample for LDAP authentication using the LDAP service installed on the swarm.cs.pub.ro} server:<code> $conf['authtype'] = 'ldap'; $conf['auth']['ldap']['port'] = 636; $conf['auth']['ldap']['server'] = 'ldaps:swarm.cs.pub.ro'; $conf['auth']['ldap']['usertree'] = 'ou=People,dc=swarm,dc=cs,dc=pub,dc=ro'; $conf['auth']['ldap']['grouptree'] = 'ou=Group,dc=swarm,dc=cs,dc=pub,dc=ro'; $conf['auth']['ldap']['userfilter'] = '(&(uid=%{user})(objectClass=posixAccount))'; $conf['auth']['ldap']['groupfilter'] = '(&(objectClass=posixGroup)(|(gidNumber=%{gid})(memberUID=%{user})))'; # This is optional but may be required for your server: $conf['auth']['ldap']['version'] = 3; # Mapping can be used to specify where the internal data is coming from. $conf['auth']['ldap']['mapping']['name'] = 'cn'; # Name of attribute Active Directory stores it's pretty print user name. $conf['auth']['ldap']['mapping']['grps'] = array('memberof' ⇒ '/CN=(.+?),/i'); # Optional debugging $conf['auth']['ldap']['debug'] = 1; </code> * The conf_authtype_ldap} line enables LDAP authentication. * The conf_auth_ldap_debug_1} line should be commented out after the configuration is working. * IMPORTANT: You may not have write access to the local.php} configuration file. Unfortunatelly there is no web interface for LDAP authentication configuration. The simplest solution is asking the system administrator to give you access rights to that file. ==== Disable Register Action ==== In case you choose to use LDAP authentication, you should disable the Dokuwiki's register} option, enabling users to automatically create an account for DokuWiki plain authentication. This can be accomplished by two means: # use the conf_disableactions_register} line in local.php}; # use the DokuWiki's administrative configuration_manager} link (search for disableactions}). === Split authentication === The LDAP service often offers little support for group authorization inside DokuWiki. A better approach would be authenticating through LDAP and using another engine for authentication. This can be accomplished through the use of split authentication. I'm using it to authenticate through LDAP and use the basic user.auth.php} file in DokuWiki's conf} folder. In order to provide split authentication, do the following: # Download the experimental authentication backends and unpack them in DokuWiki's installation folder (as mentioned here). # Update the local.php} file with configuration lines such as these:<code> $conf['authtype'] = 'split'; $conf['auth']['split']['login_auth'] = 'ldap'; # the auth backend for authentication $conf['auth']['split']['groups_auth'] = 'plain'; # the auth backend that supplies groups $conf['auth']['split']['merge_groups'] = false; # should groups from login auth also be included $conf['auth']['split']['use_login_auth_for_users'] = true; # Should login auth be used for supplying the list of users for usermanager $conf['auth']['split']['use_login_auth_for_name'] = true; # Should login auth supply user name, or only used if groups auth provides an empty name $conf['auth']['split']['use_login_auth_for_mail'] = true; # Should login auth supply email address, or only used if groups auth provides empty email. </code> #* I assumed the configuration lines for LDAP are already there. #* In the above configuration, we are using LDAP for authentication and the plain} engine for groups and authorization. # Authorization configuration is done by editing the users.auth.php} file. Some sample lines are shown below:<code> # user:MD5password:Real Name:email:groups,comma,separated razvan:x:Razvan Deaconescu:x:admin,so oana:x:Oana Baron:x:so ddvlad:x:Vlad Dogaru:x:so dbaluta:x:Daniel Baluta:x:so apitis:x:Andrei Pitis:x:so bdrutu:x:Bogdan Drutu:x:so catalinme:x:Catalin Moraru:x:so […] </code> #* The md5password} and email} fields are provided by the LDAP authentication engine and aren't filled. This may also hold true for real_name} but I didn't check. # You can now use the access_control_list_management} link in the Administration menu for authorization: configuring access rights for users and groups. == Upgrading == DokuWiki has a smart notification system that lets you know whether a new version of DokuWiki is available. A DokuWiki upgrade is fairly easy to accomplish. The upgrade steps are described on the official page. The steps below have been undertaken during an actual upgrade. # Backup the previous DokuWiki folder<code> $ cp -a wiki/ 2009-12-30-wiki-bak </code> # Download a new version of DokuWiki. I'm upgrading to the current stable version.<code> $ wget http://www.splitbrain.org/_media/projects/dokuwiki/dokuwiki-2009-12-25.tgz $ ls 2009-12-30-wiki-bak dokuwiki-2009-12-25.tgz lab wiki </code> # Unpack the DokuWiki archive.<code> $ tar xzf dokuwiki-2009-12-25.tgz $ ls 2009-12-30-wiki-bak dokuwiki-2009-12-25 dokuwiki-2009-12-25.tgz lab wiki </code> # Copy new files over the old wiki installation. Overwrite existing files.<code> $ cp -rf dokuwiki-2009-12-25/* wiki/ </code> # Do a check for files to be removed and remove them.<code> $ rm inc/lang/ar/wordblock.txt […] </code> # Check permissions, especially permission on data} folder (web user must have write access enabled). # Update plugins. I'm upgrading the googleanalytics, include, displaywikipage, creole and indexmenu plugins.<code> $ cd lib/plugins/ $ wget http://cloud.github.com/downloads/tatewake/dokuwiki-plugin-googleanalytics/googleanalytics-stable.tar.gz $ tar xzf googleanalytics-stable.tar.gz $ rm googleanalytics-stable.tar.gz $ wget http://cloud.github.com/downloads/dokufreaks/plugin-include/plugin-include.tgz $ tar xzf plugin-include.tgz $ rm plugin-include.tgz $ wget http://cloud.github.com/downloads/tatewake/dokuwiki-plugin-displaywikipage/displaywikipage-stable.tar.gz $ tar xzf displaywikipage-stable.tar.gz $ rm displaywikipage-stable.tar.gz $ wget http://www.chimeric.de/_src/plugin-creole.tgz $ tar xzf plugin-creole.tgz $ rm plugin-creole.tgz $ wget http://samuele.netsons.org/dokuwiki/media/indexmenu.zip $ unzip indexmenu.zip $ rm indexmenu.zip </code> # Clean the workplace.<code> $ rm dokuwiki-2009-12-25.tgz $ rm -fr dokuwiki-2009-12-25/ </code> # Write a script for the above steps. I've been too lazy to do it myself :-) Use the script below. === Upgrade script === Our administration Git repository now contains a Dokuwiki upgrade script. A sample run is shown below:<code> elf:~/repo-admin.git/dokuwiki# ./upgrade_dokuwiki ~srisp/public_html/dokuwiki/ ~srisp/public_html/bak/ http://www.splitbrain.org/_media/projects/dokuwiki/dokuwiki-2009-12-25c.tgz * Downloading Dokuwiki from http://www.splitbrain.org/_media/projects/dokuwiki/dokuwiki-2009-12-25c.tgz … done * Unpacking Dokuwiki to /tmpdokuwiki … done * Backing up Dokuwiki instance to /home/srisp/public_html/bakdokuwiki-bak-2010-01-22 … done * Upgrading Dokuwiki installation in /home/srisp/public_html/dokuwiki/ … done * Cleaning up temporary files … done </code> Enjoy!

tutorials/dokuwiki.1315858441.txt.gz · Last modified: 2011/09/12 23:14 by razvan