Fetching contributors…
Cannot retrieve contributors at this time
172 lines (126 sloc) 8.14 KB
deprecated author description keywords license alias modified modified_by published title
name email
Install and configure a structured wiki with TWiki.
wiki,twiki,structured wiki,enterprise wiki
Friday, October 4th, 2013
Tuesday, April 5th, 2011
TWiki on Fedora 14

TWiki is a robust "structured wiki" roughly comparable to other "Enterprise" wiki solutions such as Confluence. Structured wikis provide a powerful way to share, store, and work with information in task centric applications. TWiki is a foundation for supporting content-centric workflows including bug and issue tracking, knowledge management, and data entry. Written in Perl and distributed under the terms of the GNU GPL, TWiki is highly extensible and has a robust and active plug-in infrastructure. Because of this flexibility, TWiki straddles the boundary between web application and web application framework. This guide outlines a basic TWiki installation, setup, and configuration process.

Prepare System and Install TWiki

Install Prerequisites

Issue the following command to update your system's package database, ensure that all installed packages are up to date, and install :

yum update 
yum install httpd gdal-perl perl-CGI perl-CGI-Session perl-HTML-Tree perl-Error perl-FreezeThaw gd 

Install TWiki

At the time of writing the most recent release of TWiki is 5.0.1. Check the TWiki upstream to confirm this is the most current version. Issue the following sequence of commands to download TWiki, extract the files, and set the appropriate permissions:

cd /opt
tar -zxvf /opt/TWiki-5.0.1.tgz 
mkdir -p /srv/www/
mv /opt/twiki /srv/www/
chown -R apache /srv/www/
cp /srv/www/ /srv/www/

The TWiki files are now installed in the /srv/www/ directory. This is not, and should not be, within the public DocumentRoot for your site.

Configure Software

Configure Apache Web Server

Create a virtual host specification that resembles the following. Modify the references to and /srv/www/ to reflect the domain name and file paths for you deployment.

{: .file-excerpt } /etc/httpd/conf.d/twiki.conf : ~~~ apache <VirtualHost *:80> ServerName ServerAlias

       DocumentRoot /srv/www/ 

       ErrorLog /srv/www/ 
       CustomLog /srv/www/ combined

       ScriptAlias /bin "/srv/www/"
       Alias /pub "/srv/www/"
       Alias / "/srv/www/"
       <Location "/">
          Options -Indexes +ExecCGI

       SetEnvIf Request_URI "pub/.*\.[hH][tT][mM]?$" blockAccess
       SetEnvIf Request_URI "pub/TWiki/.*\.[hH][tT][mM]?$" !blockAccess
       BrowserMatchNoCase ^$ blockAccess
       <Directory "/srv/www/">
          AllowOverride None
          Order Allow,Deny
          Allow from all
          Deny from env=blockAccess

          Options ExecCGI FollowSymLinks
          SetHandler cgi-script

          <FilesMatch "^configure.*">
             SetHandler cgi-script
             Order Deny,Allow
             Deny from all
             Allow from
       <Directory "/srv/www/">
          Options None
          AllowOverride Limit
          Allow from all
          AddType text/plain .shtml .php .php3 .phtml .phtm .pl .py .cgi

In this configuration your wiki will be located at the root level of the domain. Modify the following lines if you wish to deploy TWiki at a different location on your domain.

{: .file-excerpt } /etc/httpd/conf.d/twiki.conf : ~~~ apache ScriptAlias /wiki/bin "/srv/www/" Alias /wiki/pub "/srv/www/" Alias /wiki/ "/srv/www/" ~~~

In this example, TWiki will be accessible by at the location. The path you configure for TWiki need not correlate to the actual location of the files on the file system. Issue the following commands to create the required directories:

mkdir -p /srv/www/
mkdir -p /srv/www/

Configure TWiki

Edit the $twikiLibPath value in the /srv/www/ file to reflect the location of the lib files in the TWiki directory on your system, as in the following example:

{: .file-excerpt } /srv/www/ : ~~~ perl $twikiLibPath = "/srv/www/"; ~~~

Before you can proceed with the installation process, you will need to configure the access control settings in the Apache Configuration (as above) so that you will be able to access your TWiki instance. Consider the following configuration directives:

{: .file-excerpt } /etc/httpd/conf.d/twiki.conf : ~~~ apache <FilesMatch "^configure.*"> SetHandler cgi-script Order Deny,Allow Deny from all Allow from ~~~

Add your local IP address to the Allow from directive in the FilesMatch block to allow access to the configuration scripts. For more information about access control with Apache, consider the Rule Based Access Control document.

When you've completed these modifications, issue the following commands to start the web server for the first time and ensure that the server starts following the next reboot cycle:

/etc/init.d/httpd start
chkconfig httpd on

Install TWiki

If your wiki is accessible at, visit to begin the configuration process. Enter an administrative password, and click the "Configure" button. Next, click on the "General path settings" option to ensure that the configuration script has properly deduced the location of all required files. Once you have confirmed these setting click on the "Next" option. On the next page select the "Save" option to save these settings.

Add the following line to the /srv/www/" file. Make sure that you do not append this line to the very end of the file.

{: .file-excerpt } /srv/www/ : ~~~ perl $TWiki::cfg{ScriptUrlPaths}{view} = ''; ~~~

Log into the configuration section at, using the password configured above. In the "Store Settings" change the value of the {StoreImpl} value to RcsLite. Click "Next" and "Save" to store these values. Visit" to register new users to be able to edit the wiki. Although mail configuration is beyond the scope of this document, you will need to install a mail server and configure TWiki in the "Mail and Proxies" section of the configuration interface before TWiki will be able to successfully send email notifications and messages.

Congratulations! You have successfully installed TWiki. You can now visit your wiki at

More Information

You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.