Computer: Knowledge-Management mit TWiki (aus Wiki)

TWiki Gehört zu: Knowledge Management, Consulting

Meine mit TWiki gemachte WebsiteTWiki habe ich in 2007 nach MediaWiki migriert.

TWiki das WikiWiki für mein Knowledge-Management (aus Wiki)

Installationsgeschichte

Bei der ersten Installation von TWiki habe ich mich genau an das TWiki:TWiki.WindowsInstallCookbook gehalten. Nach vier Monaten der Nutzung haben mich nun aber doch einige Dinge an der Art der Erst-Installation gestört:

  • Installationsordner ausserhalb des Document-Root von Apache
  • Langsame Ausführung der TWiki-Perl-Skripts im CGI-Standard-Modus
  • Starke Abhängigkeit von Cygwin (Cygwin Perl, Cygwin RCS, Cygwin Mountpoints)
  • Shebang-Zeile in den Perl-Scripts

Folgende Veränderungen der Installation habe ich heute durchgeführt:

  • TWiki-Dateipfad: d:\home\kracht\www\twiki ( URL: http://localhost/twiki )
  • ActivePerl 5.6 (als Voraussetzung für ”mod_perl”)
  • Installation von ”mod_perl” für die schnelle Ausführung von Perl-Scripts unter Apache
  • Angabe von Datei-Pfaden nicht mehr bezogen auf Cygwin-Mounts (/twiki/bin/…), sondern als Windows Dateipfade (d:/home/kracht/www/twiki/bin/…)

2007-04-08 Installation der TWiki-Version 4.1.1

Zuerst in der alten TWiki-Version (02 Sept 2004 1742 “Cairo”)

  • TWiki.TwikiPreference: SMTPMAILHOST = localhost

Installationsbeschreibung: http://TWiki.org/cgi-bin/view/TWiki/TWikiDocumentation

  • Apache: 1.3.29
  • Perl: 5.6 —> 5.8
  • Installationsverzechnis: e:/var/www/htdocs/wiki
  • Das File e:/var/www/htdocs/wiki/bin/LocalLib.cfg aus dem Txt-File erstellen
  • Apache httpd.conf: ScriptAlias und Alias einrichten (als erster Schritt)
  • Im Skript-File “configure” die Shebang-Zeile ändern auf: #!/perl/bin/perl ….
  • Das Skript “configure” starten ([[http://braunbaer.kr8.de/wiki|http://braunbaer.kr8.de/wiki]])
    • Pfade eintragen
    • LoginManager = TemplateLogin
    • PasswordManager = HtPasswdUser
    •  …
  • Shebang-Zeile in allen Perl-Skripten in wiki/bin ändern
  • Passwort-File .htpasswd nach wiki/data/.htpasswd kopieren
  • Kracht-Wiki kopieren von twiki/data/Kracht nach wiki/data/Kracht
  • User einrichteen
  • User-Berechtigungsprüfung per Apache einrichten (“AuthType Basic” für wiki/bin in httpd.conf oder .htaccess)

Weitere Änderungen der Konfiguration:

  • {MapUserToWikiName} $TWiki::cfg{MapUserToWikiName} = 0;
  • {Register}{NeedVerification} $TWiki::cfg{Register}{NeedVerification} = 0;
  • {Htpasswd}{Encoding} $TWiki::cfg{Htpasswd}{Encoding} = ‘sha1’;
  • {SafeEnvPath} $TWiki::cfg{SafeEnvPath} = ‘d:\\Programme\\gnurcs\\bin\\win32;c:\\WINNT\\system32’;

Perl Module

  • Active Perl: PPM install CGI-Session …..

2004-11-27 Installation der Version 02 Sep 2004

Auf meinem neuen PC, den ich ComputerBraunbaer getauft habe, installiere ich die neue Version (02 Sep 2004) von TWiki. Auf diese war ich aufmerksam geworden, weil die TWiki-Installation (Version 01 Feb 2003) bei meinem WebProvider ProviderWesthost ein Sicherheitsproblem hatte und gehackt wurde.

Die Installation auf Braunbaer mit Windows2000 will ich so einfach und robust wie möglich machen, d.h. ganz ohne Cygwin und mit einem stabilen RCS (also nicht RCSLite) auf Win32-Basis. Das TWiki-Modul ”’RcsWrap.pm”’ enthält aber leider noch einen gemeinen Fehler, den ich erst nach mehreren Stunden der Analyse finde:

<pre>
Zeile 106: #TODO set from TWiki.cfg
Zeile 107: my $cmdQuote = “‘”;
</pre>
Für Windows2000 muss das geändert werden in:
<pre>
Zeile 106: #TODO set from TWiki.cfg
Zeile 107: my $cmdQuote = “\””;
</pre>
Dann funktionieren die RCS-Funktionalitäten von TWiki.

”’Peter Thoeny möge sich schämen, wie vielen Menschen hat er wie viele Stunden ihres Lebens gestohlen?”’

Neue TWiki-Installation auf ComputerBraunbaer (ohne Cygwin)

  • Definitive Software Library ID: ”’TWiki”’
  • Name: TWiki
  • Version: 02 Sep 2004 (Security Update)
  • Hersteller/Bezugsquelle: Peter Thoeny http://twiki.org
  • Systemvoraussetzungen: Perl, GNU RCS, Apache, UnxTools
  • Installations-Ordner: E:\var\www\htdocs\twiki
  • Konfiguration: E:\var\www\htdocs\twiki\bin\setlib.cfg (Einzelheiten s.u.)
    • Prüfen der Installation: http://localhost/twiki/bin/testenv
    • RCS: ohne Cygwin, auf DOS-Ebene mit GNURCS und den UnxTools
    • RCS-Locks: Die Locks sind auf User ”’dkracht”’, deshalb muss der Apache-Service auch unter dieser UserId laufen

Konfigurationsdatei: …\www\htdocs\twiki\bin\setlib.cfg

<pre>
# ————– Change these settings if required

# Path to lib directory containing TWiki.pm. Set to absolute file path:
$twikiLibPath = ‘e:/var/www/htdocs/twiki/lib’;

# Path to local Perl modules (e.g. under home directory for users
# without ‘root’ on Unix/Linux). Uncomment and set if needed:
# $localPerlLibPath = ”;
</pre>

Konfigurationsdatei: …\www\twiki\lib\TWiki.cfg

<pre>
# variables that need to be changed when installing on a new server:
# ”'<tt>==============================================================</tt>”’
# —- Windows paths should normally be written as “c:/foo” not “c:\foo”
# —- (which doesn’t do what you may think it does). You can use ‘\’
# —- without problems inside single quotes, e.g. ‘c:\foo’.
$defaultUrlHost = “http://braunbaer.kr8.de”;
# %SCRIPTURLPATH% : cgi-bin URL path for TWiki:
$scriptUrlPath = “/twiki/bin”;
# %PUBURLPATH% : Public data URL path for TWiki (root of attachments) :
$pubUrlPath = “/twiki/pub”;
# Public data directory (file path not URL), must match $pubUrlPath :
$pubDir = “e:/var/www/htdocs/twiki/pub”;
# Template directory :
$templateDir = “e:/var/www/hatdocs/twiki/templates”;
# Data (topic files) root directory (file path not URL):
$dataDir = “e:/var/www/htdocs/twiki/data”;
# Log directory for log files, debug and warning files. Default “$dataDir” :
$logDir = “$dataDir”;

$saveEnvPath = ‘D:\Programme\gnurcs\bin\win32;c:\WINNT\system32’;
$rcsDir = “D:/Programme/gnurcs/bin/win32”;
$StoreTopicImpl = “RcsWrap”;
$lsCmd = ‘D:\Programme\gnurcs\bin\win32\ls’; (aus Sourceforge: UnxTools)
$egrepCmd = ‘D:\Programme\gnurcs\bin\win32\egrep’; (aus Sourceforge: UnxTools)
$fgrepCmd = ‘D:\Programme\gnurcs\bin\win32\fgrep’; (aus Sourceforge: UnxTools)

$editLockTime = “300”;
</pre>

Konfigurationsdatei: …\www\twiki\bin\.htaccess

Das war noch eine kleine Gemeinheit: Was ich auch in die Apache-Konfigurationsdatei ”httpd.conf” eingetragen habe, egalweg wollte ”’mod_perl”’ für die Scripts hier nicht zur Anwendung kommen. Erst das Auskommentieren von ”’SetHandler cgi-script”’ brachte dann den Erfolg.
<pre>
# bin/.htaccess.txt
#
# Controls access to TWiki scripts – rename this to ‘.htaccess’ to make
# Apache use it.

# Use CGI & Perl to handle all files in ‘bin’ directory, i.e. run as scripts
# – this should remove the need to rename files to end in ‘.pl’ etc,
# if your web hosting provider permits this. Remove if using mod_perl.
####SetHandler cgi-script
</pre>

User-Ids und Passwörter

Für die Ausführung bestimmter Perl-Scripts (z.B. edit, save) wird eine Authentifizierung verlangt. User-Ids und Passwörter sin in der Datei ”’.htpasswd”’ gespeichert. Diese Datei wird mit Hilfe des zu [[Apache|Apache]] gehörigen Dienstprogramms ”’htpasswd.exe”’ erstellt. Standardmässig wird von den Passwörtern ein MD5-Hash gespeichert (wahlweise auch ein SHA1-Hash).

  • htpasswd -cs .htpasswd dkracht
  • htpasswd -s .htpasswd DietrichKracht

Die obigen Befehle erzeugen eine Passwort-Datei ”’.htpasswd”’ mit den Usern “dkracht” und “DietrichKracht” und entsprechenden Passwörtern als SHA1-Hashs. Diese Datei muss dann nach /twiki/data kopiert werden… (s.u. AuthUserFile)

<pre>
# Password file for TWiki users
#
# The path here must be a system file pathname, not a URL – first part should
# match the $dataDir setting in TWiki.cfg
AuthUserFile e:/var/www/htdocs/twiki/data/.htpasswd
AuthName ‘Enter your WikiName: (First name and last name, no space, no dots, capitalized, e.g. JohnSmith). Cancel to register if you do not have one.’
AuthType Basic

# File to return on access control error (e.g. wrong password)
# The path here must be a URL path, not a file pathname – first part should
# match the $scriptUrlPath in TWiki.cfg
ErrorDocument 401 /twiki/bin/oops/TWiki/TWikiRegistration?template=oopsauth
</pre>

Apache Konfiguration

Für die Lauffähigkeit von TWiki mussen in der Apache-Konfigurationsdatei ”https.conf” folgende Eintragungen vorgenommen werden.
<pre>
<IfModule mod_env.c>
SetEnv TZ CET-1EST
SetEnv RCSINIT -x,v/
SetEnv TEMP e:/tmp
SetEnv TMP e:/tmp
SetEnv LOGNAME dkracht
# SetEnv PERL5SHELL “cmd.exe /x/c”
</IfModule>
</pre>

TWiki.TWikiPreferences

Im Dokument (Topic) TWiki.TWikiPreferences werden noch folgende Parameter eingestellt:

  • WIKIWEBLIST = Kracht Consulting TWiki Sandbox
  • WEBBGCOLOR = #C0C0C0
  • WIKIWEBMASTER = xxx@kr8.org
  • ALLOWTOPICCHANGE = Main.TWikiAdminGroup

WebPreferences

Im Dokument (Topic) Kracht.WebPreferences werden folgende Parameter eingestellt:

  • SKIN = kracht

Diese in der alten TWiki-Version entwickelte Skin besteht aus folgenden Template-Dateien:

  • attach.kracht.tmpl
  • edit.kracht.tmpl
  • preview.kracht.tmpl
  • print.kracht.tmpl
  • rdiff.kracht.tmpl
  • search.kracht.tmpl
  • view.kracht.tmpl

Diese Skin-Templates liegen im Ordner /twiki/templates

Cascading Stylesheet (CSS)

Zur Gestaltung der Optik wurde ein eignenes Stylesheet ”’blue.css”’ entwicklet, dies liegt in ”’/twiki/css”’.

Damit dieses Stylesheet auch für alle Steiten verwendet wird, habe ich zwei Zeilen in ”’twiki.tmpl”’ einfügen müssen(?).

Letzte Aktionen

Der User Main.DietrichKracht ist anzulegen, einzutragen in Main.TWikiUsers und in Main.TWikiAdminGroup

TWiki Installation auf lonzo.kr8.de

  • Definitive Software Library ID: ”’TWiki”’
  • Name: TWiki
  • Version: 01 Feb 2003
  • Hersteller/Bezugsquelle: Peter Thoeny http://twiki.org
  • Installations-Ordner: D:\home\kracht\www\twiki
  • Konfiguration: D:\home\kracht\www\twiki\bin\setlib.cfg (Einzelheiten s.u.)
  • Systemvoraussetzungen: [[Perl|Perl]], [[RCS|RCS]], [[Apache|Apache]], [[Cygwin|Cygwin]], UnxTools

TWiki Konfigurationsdatei: …\www\twiki\bin\setlib.cfg

<pre>
# ————– Change these settings if required

# Path to lib directory containing TWiki.pm. Set to absolute file path:
$twikiLibPath = ‘d:/home/kracht/www/twiki/lib’;

# Path to local Perl modules (e.g. under home directory for users
# without ‘root’ on Unix/Linux). Uncomment and set if needed:
# $localPerlLibPath = ”;
</pre>

TWiki Konfigurationsdatei: …\www\twiki\lib\TWiki.cfg

<pre>
# variables that need to be changed when installing on a new server:
# ”'<tt>==============================================================</tt>”’
# —- Windows paths should normally be written as “c:/foo” not “c:\foo”
# —- (which doesn’t do what you may think it does). You can use ‘\’
# —- without problems inside single quotes, e.g. ‘c:\foo’.
$wikiHomeUrl = “http://localhost/twiki”;
# URL for TWiki host : (e.g. “http://myhost.com:123”)
$defaultUrlHost = “http://localhost”;
# %SCRIPTURLPATH% : cgi-bin URL path for TWiki:
$scriptUrlPath = “/twiki/bin”;
# %PUBURLPATH% : Public data URL path for TWiki (root of attachments) :
$pubUrlPath = “/twiki/pub”;
# Public data directory (file path not URL), must match $pubUrlPath :
$pubDir = “d:/home/kracht/www/twiki/pub”;
# Template directory :
$templateDir = “d:/home/kracht/www/twiki/templates”;
# Data (topic files) root directory (file path not URL):
$dataDir = “d:/home/kracht/www/twiki/data”;
# Log directory for log files, debug and warning files. Default “$dataDir” :
$logDir = “$dataDir”;
</pre>

TWiki Konfigurationsdatei: …\www\twiki\bin\.htaccess

Das war noch eine kleine Gemeinheit: Was ich auch in die Apache-Konfigurationsdatei ”httpd.conf” eingetragen habe, egalweg wollte ”’mod_perl”’ für die Scripts hier nicht zur Anwendung kommen. Erst das Auskommentieren von ”’SetHandler cgi-script”’ brachte dann den Erfolg.
<pre>
# bin/.htaccess.txt
#
# Controls access to TWiki scripts – rename this to ‘.htaccess’ to make
# Apache use it.

# Use CGI & Perl to handle all files in ‘bin’ directory, i.e. run as scripts
# – this should remove the need to rename files to end in ‘.pl’ etc,
# if your web hosting provider permits this. Remove if using mod_perl.
####SetHandler cgi-script
</pre>

User-Ids und Passwörter

Für die Ausführung bestimmter Perl-Scripts (z.B. edit, save) wird eine Authentifizierung verlangt. User-Ids und Passwörter sin in der Datei ”’.htpasswd”’ gespeichert. Diese Datei wird mit Hilfe des zu [[Apache|Apache]] gehörigen Diensprogramms ”’htpasswd.exe”’ erstellt. Standardmässig wird vonden Passwörtern ein MD5-Hash gespeichert (wahlweise auch ein SHA1-Hash).
* htpasswd -cs .htpasswd dkracht
* htpasswd -s .htpasswd DietrichKracht
Die obigen Befehle erzeugen eine Passwort-Datei ”’.htpasswd”’ mit den Usern “dkracht” und “DietrichKracht” und entsprechenden Passwörtern als SHA1-Hashs. Diese Datei muss dann nach /twiki/data kopiert werden… (s.u. AuthUserFile)

<pre>
# Password file for TWiki users
#
# The path here must be a system file pathname, not a URL – first part should
# match the $dataDir setting in TWiki.cfg
AuthUserFile d:/home/kracht/twiki/data/.htpasswd
AuthName ‘Enter your WikiName: (First name and last name, no space, no dots, capitalized, e.g. JohnSmith). Cancel to register if you do not have one.’
AuthType Basic

# File to return on access control error (e.g. wrong password)
# The path here must be a URL path, not a file pathname – first part should
# match the $scriptUrlPath in TWiki.cfg
ErrorDocument 401 /twiki/bin/oops/TWiki/TWikiRegistration?template=oopsauth
</pre>

Apache Konfiguration

Für die Lauffähigkeit von TWiki mussen in der Apache-Konfigurationsdatei ”https.conf” folgende Eintragungen vorgenommen werden.
<pre>
<IfModule mod_env.c>
SetEnv LOGNAME system
SetEnv PERL5SHELL “d:/Programme/cygwin/bin/bash.exe -c”
SetEnv PERL5LIB “d:/home/kracht/www/twiki/bin”
</IfModule>
</pre>

———–

Kategorien mit TWiki WebForms

Als erstes muss für das betroffene TWiki-Web (hier: “Kracht”) die Funktionalität “WebForms” aktiviert werden. Das geschieht im Dokument (“Topic”) WebPreferences durch die Angabe:

  • Set WEBFORMS = form1, form2, form3,…

Als Nächstes müssen dann die Forms angelegt werden (hier: WebForm) :
<blockquote style=”background-color: yellow”>

Name Type Size Values Tooltip message
TopicClassification text 32 Classification
TopicSummary text 32 Summary
DefinitiveSoftwareLibrary checkbox 1 DSL Is this an entry to the DSL?
ClientRelation text 32 What Client is related to this?
RelatedTopics text 32 Whot topics are related to this?

</blockquote>

Als Drittes müssen dann die bereits vorhandenen Dokumente (Topics) mit “Edit” und “Add form” nachträglich mit den beschreibenden Informationen der WebForm (Kategorien u.a.) versehen werden.

Als Viertes werden dann Abfrage-Dokumente für die Kategorien angelegt (mit “%SEARCH….”) z.B. [[TopicClassification]].

— Main.DietrichKracht – 01 May 2004