TWiki on CentOS 5

Select distribution:
Traducciones al Español
Estamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
Deprecated

This guide has been deprecated and is no longer being maintained.

Create a Linode account to try this guide with a $ credit.
This credit will be applied to any valid services used during your first  days.

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
wget http://downloads.sourceforge.net/project/twiki/TWiki%20for%20all%20Platforms/TWiki-5.0.1/TWiki-5.0.1.tgz
tar -zxvf /opt/TWiki-5.0.1.tgz
mkdir -p /srv/www/example.com/
mv /opt/twiki /srv/www/example.com/twiki
chown -R apache /srv/www/example.com/twiki
cp /srv/www/example.com/twiki/bin/LocalLib.cfg.txt /srv/www/example.com/twiki/bin/LocalLib.cfg

The TWiki files are now installed in the /srv/www/example.com/ 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 example.com and /srv/www/example.com/ to reflect the domain name and file paths for you deployment.

File: /etc/httpd/conf.d/twiki.conf
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<VirtualHost *:80>
       ServerName example.com
       ServerAlias www.example.com

       DocumentRoot /srv/www/example.com/public_html

       ErrorLog /srv/www/example.com/logs/error.log
       CustomLog /srv/www/example.com/logs/access.log combined

       ScriptAlias /bin "/srv/www/example.com/twiki/bin"
       Alias /pub "/srv/www/example.com/twiki/pub"
       Alias / "/srv/www/example.com/twiki/bin/view/"
       <Location "/">
          Options -Indexes +ExecCGI
       </Location>

       SetEnvIf Request_URI "pub/.*\.[hH][tT][mM]?$" blockAccess
       SetEnvIf Request_URI "pub/TWiki/.*\.[hH][tT][mM]?$" !blockAccess
       BrowserMatchNoCase ^$ blockAccess
       <Directory "/srv/www/example.com/twiki/bin">
          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 127.0.0.1
          </FilesMatch>
       </Directory>
       <Directory "/srv/www/example.com/twiki/bin">
          Options None
          AllowOverride Limit
          Allow from all
          AddType text/plain .shtml .php .php3 .phtml .phtm .pl .py .cgi
       </Directory>
</VirtualHost>

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

File: /etc/httpd/conf.d/twiki.conf
1
2
3
4
ScriptAlias /wiki/bin "/srv/www/example.com/twiki/bin"
Alias /wiki/pub "/srv/www/example.com/twiki/pub"
Alias /wiki/ "/srv/www/example.com/twiki/bin/view/"
</VirtualHost>

In this example, TWiki will be accessible by at the http://example.com/wiki 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/example.com/public_html
mkdir -p /srv/www/example.com/logs

Configure TWiki

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

File: /srv/www/example.com/twiki/bin/LocalLib.cfg
1
$twikiLibPath = "/srv/www/example.com/twiki/lib";

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: /etc/httpd/conf.d/twiki.conf
1
2
3
4
5
6
<FilesMatch "^configure.*">
       SetHandler cgi-script
       Order Deny,Allow
       Deny from all
       Allow from 127.0.0.1
</FilesMatch>

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 http://example.com, visit http://example.com/bin/configure 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/example.com/twiki/lib/LocalSite.cfg" file. Make sure that you do not append this line to the very end of the file.

File: /srv/www/example.com/twiki/lib/LocalSite.cfg
1
$TWiki::cfg{ScriptUrlPaths}{view} = '';

Log into the configuration section at http://example.com/bin/configure, 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 http://example.com/TWiki/TWikiRegistration" 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 http://example.com/

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.

This page was originally published on


Your Feedback Is Important

Let us know if this guide was helpful to you.


Join the conversation.
Read other comments or post your own below. Comments must be respectful, constructive, and relevant to the topic of the guide. Do not post external links or advertisements. Before posting, consider if your comment would be better addressed by contacting our Support team or asking on our Community Site.