TWiki on Debian
Installing TWiki
2013-06-02: TWiki is no longer available as a Debian package.
Installation is as easy as
apt-get install twiki apache2. The default locations for installed components are integrated with the Debian Apache (1.3 and 2.2) packages. The URL for your newly installed TWiki is then
http://localhost/cgi-bin/twiki/view/Main/WebHome
Debian
has a
twiki package
(TWiki 4.0.5) in current stable release - Etch. In other words, TWiki is now distributed on
all current DVD's of debian.
TWiki 4.1.2 can be found in and installed from the Debian Unstable and Testing repositorys, or Sven's test staging area mentioned below. From 4.1.2-4 onwards, the TWiki configure based plugins and extensions installer works.
NOTE: Root privileges are required in order to install a .deb (Debian package).
TWiki Plugins
From 4.1.2-4 onwards, the TWiki configure based plugins and extensions installer works. Versions prior to this will need to install into the /var/lib/twiki directory manually.
Thanks to
The package was originally created by Mark W. Eichin. And is now maintained by
SvenDowideit with considerable help from Debian Developer co-maintainer Amaya Rodrigo Sastre and Debian sponsor --
ArdoVanRangelrooij
Bug Reporting
To report problems with the
Debian package of TWiki
, go to the
Debian Bug tracking system
.
There is an
InterWiki rule for Debian bugs - just write
DebianBug:79667
to link to Debian bugs. This should make it easy to create TWiki
BugReports for specific bugs that need fixing in TWiki (rather than Debian packaging bugs).
Outstanding issues are listed at
DebianBug:twiki
. (
http://bugs.debian.org/cgi-bin/pkgreport.cgi?which=pkg&data=twiki&archive=no&pend-exc=fixed&pend-exc=done
)
Debian Package Development details
Debian has to a
very rigid
set of rules
that specifies to which directories a package may install various types of files. This policy keeps a Debian installation compliant with the
Filesystem Hierarchy Standard
.
There is a "compatibility directory", in
/var/lib/twiki with symbolic links named
bin,
pub, etc. that point to
/usr/lib/cgi-bin/twiki,
/var/www/twiki/pub so that users can unpack plugins in
/var/lib/twiki.
The debian files used to create the debian package are in the TWiki
SVN repository at
http://svn.twiki.org/svn/twiki/trunk/core/tools/pkg/
A non-root user can, get the source using
apt-get source twiki, or unpack it
by hand (it's just an
ar archive
), install it, and take a look at the maintainer scripts (in
DEBIAN/{pre,post}{inst,remove}).
If you are interested in testing - Sven has a staging are for people that want to try out development packages (including Plugins) - see
DistributedINFORMATION.com Blog
for updates
deb http://distributedinformation.com/debian/ stable main contrib
deb-src http://distributedinformation.com/debian/ stable main contrib
Multiple TWikis on the same Debian host
I installed the Debian package for twiki (20040902-3), looking for a way to run a separate twiki (ala, custom pub/, data/, and template/ directories) for each of several dozen domains on the server, while retaining the same core codebase (cgi-bin/) for ease of upgrades.
Each domain's file space is housed in /web/[domain]/web/, and I wanted to store a custom twiki/ (with data/ and templates/ subdirs, located by default in /var/lib/twiki/) in /web/[domain]/twiki/ .
Usually, I do this kind of thing by using Apache's SERVER_NAME environment variable in PHP to populate appropriate configuration variables regarding filesystem paths. Perl's taint checking wouldn't allow me to use that, however (and good on it!).
My solution was to manually validate the Apache SERVER_NAME variable as a valid domain name (no slashes, double dots, etc). I put this at the top of
/etc/twiki/TWiki.cfg:
# Validate and untaint Apache's SERVER_NAME Environemnet variable
# for use in referencing virtualhost-based paths
# for separate data/ and templates/ instances, etc
if ( $ENV{SERVER_NAME} =~ /^(([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6})$/ ) {
$ENV{SERVER_NAME} = $1 ; }
Once that's done,
$ENV{SERVER_NAME} is safe to use in variables later in
TWiki.cfg, like so:
$dataDir = "/web/". $ENV{SERVER_NAME} ."/twiki/data";
Furthermore, some changes are necessary to
/etc/twiki/.htaccess and the apache
VirtualHost section for the site you want to run each twiki on. This is so you can use a different user password file for each TWiki instance. The default password file is located in
/var/lib/twiki/data/.htpasswd .
I had to Comment out this section of
/etc/twiki/.htaccess:
# Authentication type (htpasswd file) (comment out this if you configure htpasswd / LDAP support)
#AuthUserFile /var/lib/twiki/data/.htpasswd
#AuthUserFile /web/r30.net/twiki/data/.htpasswd
#AuthName 'Enter your WikiName: (First name and last name, no space, no dots, capitalized, (...)
#AuthType Basic
and then add a similar section with the
VirtualHost section in
/etc/apache/httpd.conf:
# Twiki authentication
<Location /cgi-bin/twiki >
AuthUserFile /web/r30.net/twiki/data/.htpasswd
AuthName 'Enter your WikiName: (First name and last name, no space, no dots, capitalized, (...)
AuthType Basic
</Location>
This points each domain's twiki installation at the appropriate .htpasswd file.
Hope this helps...
--
NatoWelch - 20 Apr 2005
Nato, many thanks for this howto.
Maybe this should be a topic for itself (Maybe
OneCodeBaseMultipleTWikis?,
VirtualTWikis?).
However at least in my deployment there are still some issues related to topics that need to be shared:
- To make all installed plugins work, the *Plugin topics need to be distributed (copied or linked) to the virtual twikis.
On the other hand you cannot simply share the complete TWiki web (i.e. TWikiPreferences ...)
- Some of our users/groups may work on more than one virtual twiki, so their
.htpasswd line and user + group topics need to be synchronized (and TWikiUsers needs to be changed, but that topic needs to be more dynamic anyhow ...)
--
ChristopherHuhn - 06 May 2005
Installation "Success Story"
- As to setting up TWiki, what I discovered that works best, is:
- first edit the TWikiPreferences to have the SMTPMAILHOST set correctly, then the first (and subsequent) user(s) will actually get e-mail
- note that doing this via the filesystem is recommended, and not via the browser, for reasons stated later;
- You then need to edit TWikiRegistration* files - as per the debconf dialogues - so *Pub gets moved to TWikiRegistration, etc. That you can do via the web if you want (and it'll get you used to how things work (tm));
- this has now changed - the debian does the copy for you
- Make sure everything works, register a user;
- Then open /var/lib/twiki/data/Main/TWikiAdminGroup.txt in an editor, add your first user to the list, remove the others, and uncomment (there's a # on one of the entries in that file, remove it);
- If it doesn't work, you messed up or I did ;). You can re-add the comment to give yourself access if you need it.
- Gripes, flames, comments welcome. Main.SimonRaven
-- EC
thankyou very much for the feedback

--
SvenDowideit - 17 Aug 2004
TODOs
-
/var/www/twiki/pub is not read protected against index perusal, twiki.org has a placeholder page to protect it, I've seen others that use the TWiki Registration or other error pages. This is not secure.
-
/var/lib/twiki/data/.htpasswd is world readable and writable. 11.9 of DebianPolicy
-
/var/lib/twiki/templates should probably be in /usr/share/twiki/templates or perhaps /etc/twiki/templates. If everyone were me, it'd be /etc, but I'm guessing most people don't fiddle their templates to pieces. 11.7 of DebianPolicy
- The failure of registration at the new site to generate a password was confusing. I eventually puzzled that out and manually generated the requisite
/var/lib/twiki/data/.htpasswd file via the htpasswd command. This issue may not be Debian specific, see ApachePasswords for an extended and general discussion. However, it would be nice to have more "reasonable" out of the box behavior from the Debian package. I realize that this is easier said than done but wanted to register this preference.
- More subtle and puzzling was a possible flaw in the supplied
testenv script. Following hints from TWikiInstallationGuide, I ran http://localhost/cgi-bin/twiki/testenv after fiddling with the configuration file, /etc/twiki/TWiki-site.cfg. Strangely this program failed with an apache Premature end of script headers error message. The "as provided by Debian" version of testenv begins #!/usr/bin/perl -wI.. The w command line option seems appropriate, but the I. option seemed strange (??include current directory??). So I cut it out (yielding #!/usr/bin/perl -w), and the script ran just fine. It's a handy, reassuring, utility, btw. My perl knowlege is near zero, so I don't know whether the as supplied script is bad, or if my environment is somehow incorrect.
- Fix up upgrading so that you don't loose your changes but you get the new version of the Webs (really should seperate the user's Webs from the TWiki installed Webs)
- make AdminTools more prominent
- Please put htaccess configuration data in a conffile so that admin has better control over authenticating users (perhaps use a symlink or include phrase to get data from a new file in /etc/twiki or just move all configuration into Directory statement in /etc/twiki/apache.conf). I'm using the deb from http://www.backports.org/
TO
See Also
Ubuntu support
Ubuntu uses essentially the same
twiki package as Debian, but it's best to use the Ubuntu variant to install TWiki. See
TWikiOnUbuntu for details.
--
Contributors: GrantBow,
MattWilkie,
RichardDonkin,
FrankHorowitz,
EstebanManchado,
DougAlcorn,
ArdoVanRangelrooij,
MartinRaabe,
PeterMasiar,
HendrikBoom,
MikeMaurer,
MikeSatteson,
EraEriksson,
SvenDowideit,
NatoWelch
Comments
Just tested the Debian package for TWiki, and worked like a charm. Installation went clean and I was instantly able to browse and register to TWiki at
http://localhost/twiki/
.
Congratulations for this great work.
--
AntonioTerceiro - 25 Nov 2006
Some notes for the Debian 'etch' release: It comes with 4.0.5, not 4.1.x. The default setup creates a tree in
/var/www/twiki that contains the
pub dir, everything else is in
/var/lib/twiki. The bin, lib and log are symlinks to other places in the filesystem, eg
bin ->
/usr/lib/cgi-bin/twiki.
Apache reads its twiki settings using a symlink:
/etc/apache2/conf.d/twiki.conf -> /etc/twiki/apache.conf
These can be overriden within
VirtualHost definitions if you need to.
/etc/twiki/LocalSite.cfg is the file you should modify when customising twiki.
/etc/twiki/TWiki.cfg can be consulted for variable names but don't change settings in there.
When setting up multiple vhosts I found this code useful (in
LocalSite.cfg):
my $twikibase = '/var/www/vhosts/' . $ENV{'SERVER_NAME'} . '/twiki/' ;
then I can do this, for example -
$TWiki::cfg{DataDir} = $twikibase . 'data' ;
as noted above this goes in
LocalSite.cfg, not
TWiki.cfg.
/etc/twiki/.htaccess has been removed, the same restrictions are achieved with settings in
/etc/twiki/apache.conf. You
need the restrictions around the
configure program turned on. If you override the settings in the
apache.conf with settings in your vhost, make sure to limit access to that path as well with a
Directory or
Location directive. Example: I want to have a real cgi-bin directory and not expose the other cgi programs that other packages may install in
/usr/lib/cgi-bin. So I do
mkdir /var/www/vhosts/foo
mkdir /var/www/vhosts/foo/docroot
mkdir /var/www/vhosts/foo/cgi-bin
ln -s /usr/lib/cgi-bin/twiki /var/www/vhosts/foo/cgi-bin/twiki
And in the apache configuration file for the vhost I do
ScriptAlias /cgi-bin/ /var/www/vhosts/foo/cgi-bin/
<Directory "/var/www/vhosts/foo/cgi-bin/twiki/">
...
<FilesMatch "^configure">
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</FilesMatch>
...
</Directory>
Because this vhost is getting to the
configure program by a different path, I need to limit the access for that path as well as the default path (
/usr/lib/cgi-bin/twiki) that is set up in
/etc/twiki/apache.conf.
For the multiple vhosts case you will want separate
pub and
data directories, and probably a separate
log dir as well:
mkdir -p /var/www/vhosts/foo/twiki/{pub,data,log}
and in
LocalSite.cfg
$TWiki::cfg{DataDir} = $twikibase . 'data' ;
$TWiki::cfg{LogDir} = $twikibase . 'log';
$TWiki::cfg{PubDir} = $twikibase . 'pub';
--
VinceMcIntyre - 04 Oct 2007
On a Debian system where TWiki was installed that way, I had to find out which user name and password were required to run
configure. Apparently it is
TWikiGuest and
guest, respectively. Did I miss that somewhere in the documentation?
Without a configuration I couldn't get very far because the Debian system was a
server, with no desktop, no X and no browser installed, so there was no web access from
localhost (No, I did not attempt to run
configure with Lynx). Every TWiki redirection sent me to
localhost because this value is hardwired in
{DefaultUrlHost}. Would it be a possible to replace that with
'http://' . $ENV{'SERVER_NAME'} for more flexibility?
--
HaraldJoerg - 17 Nov 2007
'http://' . $ENV{'SERVER_NAME'} - definitely not. There's a Bug Item discussing why that is a phishing vector. (I'm perfectly happy with it being done by someone that understands the risks, but the default installer needs to be tighter than it is now :/ )
I am however working towards fixing that in 4.1.2-5 - using the actual hostname. I thought that it told you about
TWikiGuest during the install, but really, it was a bad solution that I havn't changed over - in the next update, I will either:
- make it prompt you for a default user & password, that will be set for both configure, and be created as a TWikiUser that is magically added to TWikiAdminGroup (what I also am working towards with the 4.2 TWikiInstallers )
- OR - dunno - maybe there is no 2 (need to work out something for those that install with prompting off
)
Basically, yep, sorry, there are still edges, which my other work is both helping and hindering.
--
SvenDowideit - 18 Nov 2007
With the
TWikiOnUbuntu package, the Debian installer (presumably
dpkg-reconfigure) prompts you for the password for
configure, which defaults to user
TWikiGuest and password
guest. So maybe you could borrow from the Ubuntu setup if it's different to the Debian package?
I've put a pointer to
TWikiOnUbuntu under 'see also', for people who come across this and may be using Ubuntu - hope that's OK.
--
RichardDonkin - 19 Nov 2007
For manual installation of TWiki 4.2.0 on Debian Etch, see
TWikiOnDebianEtch.
Sven - any news on a TWiki 4.2 package for Debian/Ubuntu?
--
RichardDonkin - 21 Mar 2008
RichardDonkin : See
DebianBug:462560
--
OlivierBerger - 21 May 2008
Btw, there seems to be recent progress towards 4.2 package in the
SVN directory where Sven is working.
--
OlivierBerger - 21 May 2008
I updated my experimental debian repository at
http://distributedINFORMATION.com
to include a test TWiki4.2.0, and several hundred Plugin packages.
--
SvenDowideit - 30 Jul 2008
I managed to use the
pseudo-install.pl script from /var/lib/twiki on Debian, by applying the following patch :
--- pseudo-install.pl 2008-03-28 10:49:09.000000000 +0100
+++ pseudo-install.pl.new 2008-08-14 14:30:25.000000000 +0200
@@ -191,9 +191,15 @@
my $path = '';
foreach my $c ( @components ) {
if( -l $path.$c ) {
+ if ( $path )
+ {
_checkLink($moduleDir, $path, $c);
#print STDERR "$path$c already linked\n";
last;
+ }
+ else {
+ $path .= "$c/";
+ }
} elsif( -d "$path$c" ) {
$path .= "$c/";
} elsif( -e "$path$c" ) {
@@ -222,10 +228,15 @@
my $path = '';
foreach my $c ( @components ) {
if( -l "$path$c" ) {
+ if ($path) {
return unless _checkLink($moduleDir, $path, $c) || $force;
unlink "$path$c";
print "Unlinked $path$c\n";
return;
+ }
+ else {
+ $path .= "$c/";
+ }
} else {
$path .= "$c/";
}
Hope this helps.
--
OlivierBerger - 14 Aug 2008
Btw, it may be interesting for some to see the list of package files, at
http://distributedinformation.com/TWikiDebian/
--
OlivierBerger - 14 Aug 2008
I updated my experimental debian repository at
http://distributedINFORMATION.com
to include a test TWiki4.2.2, and 226 Plugin packages.
so now you can
apt-get install apache2 twiki twiki-imagegalleryplugin, and it will install all the pre-req's for you.
--
SvenDowideit - 16 Aug 2008