How to install TWiki Cairo version
This document safely guides you through the
"Cairo" version of TWiki (release 20040902).
See how to
InstallTwikiDakarOnDreamhost if you are looking for
version 4.x!
The installation guide
in the distribution needs some changes in order to work
on DreamHost.
- To install TWiki on DreamHost, follow the instructions below. I have thoroughly checked and tested this guide, and it should be complete. This is specifically for the 20040902 version; it has not been tested with other releases.
- To install TWiki with another hosting provider, follow TWikiDocumentation.html in the distribution.
Just follow this description and
replace these strings with your own:
- example server path =
/home/your_account/your_domain
- example browser URL =
hNOPttp://your_domain.example.com
- example administrator name =
YourName
Prepare the domain

Go to the Dreamhost web panel (
the Add Domain tab) and create a new (sub)domain. This will create a directory
/home/your_account/your_domain on the web server that gets http-enabled as
hNOPttp://your_domain.example.com.
Here's a direct link to the
Add Domain tab:
https://panel.dreamhost.com/index.cgi?tree=domain.add_domain&
Get and edit the TWiki files

Download and unzip the
twiki20040902.zip to a directory on your local pc. Download page:
http://twiki.org/getpackage.html

In the
data/TWiki directory, rename the file
TWikiRegistration to
TWikiRegistrationIntranet and
TWikiRegistrationPub to
TWikiRegistration. Do the same for the .txt,v files.

In
lib/TWiki.cfg, find the line that begins with
$pubDir. Before that line, insert these two lines:
# Home directory for domain
$homeDir = "/home/your_account/your_domain";

Also in
lib/TWiki.cfg, find the following lines and change them to this.
$defaultUrlHost = "hNOPttp://your_domain.example.com";
$scriptUrlPath = "/bin";
$pubDir = "$homeDir/pub";
$templateDir = "$homeDir/templates";
$dataDir = "$homeDir/data";
$noSpamPadding = "(REMOVE_THIS)";
$defaultUserName = "TWikiGuest";
$wikiHomeUrl = $defaultUrlHost;
Choice: If you want support for international characters in
WikiWords (like LöwenBräu), then change these two lines concerning
locale:
$useLocale = 1;
$siteLocale = "da_DK";
and in
lib/TWiki/Render.pm, add this line before line #39:
use locale;

In
data/TWiki/TWikiPreferences, find the following lines and change them to this.
Note: Be sure to specify
your settings; these are only examples!
* Set WIKILOGOIMG = %PUBURL%/%TWIKIWEB%/TigerSkin/GBLogoPlain.GIF
* Set WIKILOGOURL = %WIKIHOMEURL%
* Set WIKILOGOALT = Go to %WIKITOOLNAME% start page.
* Set WIKIWEBMASTER = webmaster@example.com
* Set SMTPMAILHOST =
* Additional settings if you use the TNOPWiki:PNOPlugins.HobbesSkin:
* Set BANNERSEARCHSCOPE = all
* Set WEBSITECOLOR = #05B
* Set WIKIFAVICON = %PUBURL%/%TWIKIWEB%/TigerSkin/favicon.ico

In
data/Main/TWikiAdminGroup, find the following line and change it to this:
* Set GROUP = YourName

In
/home/your_account/your_domain/.htaccess, write the following lines.
Tip: See below for tips about how to create this file using Windows Notepad.
# This redirects from the server default homepage (index.html) to Main.WebNOPHome:
# The first path must be a URL path, not a file pathname.
# The second path must be the full URL to the Main WebNOPHome topic.
Redirect /index.html hNOPttp://your_domain.example.NOPcom/Main/WebHome
# This makes the URL shorter:
Options -Indexes
RNOPewriteEngine On
RNOPewriteOptions MNOPaxRedirects=2
RNOPewriteRule ^([A-Z].*) /bin/view/$1

In
/home/your_account/your_domain/data/.htaccess, write the following line:
deny from all

In
/home/your_account/your_domain/lib/.htaccess, write the following line:
deny from all

In
/home/your_account/your_domain/templates/.htaccess, write the following line:
deny from all

In
/home/your_account/your_domain/bin/.htaccess, write the following lines:
Note: Be sure to specify the correct path to
.htpasswd or else users will not be able to log in!
# The path here must be a file pathname, not a URL - first part should
# match the $dataDir setting in TWiki.cfg
ANOPuthUserFile /home/your_account/your_domain/data/.htpasswd
ANOPuthName BNOPyPassword
ANOPuthType Basic
# No changes necessary to this line unless you are using mod_perl
SNOPetHandler cgi-script
# The path here must be a URL, not a file pathname - first part should
# match the $scriptUrlPath in TWiki.cfg
ENOPrrorDocument 401 /bin/oops/TWiki/TWikiRegistration?template=oopsauth
<Files ~ "[^/]*\.html$">
allow from all
</Files>
<Files "viewauth">
require valid-user
</Files>
<Files "edit">
require valid-user
</Files>
<Files "preview">
require valid-user
</Files>
<Files "save">
require valid-user
</Files>
<Files "attach">
require valid-user
</Files>
<Files "upload">
require valid-user
</Files>
<Files "rename">
require valid-user
</Files>
<Files "rdiffauth">
require valid-user
</Files>
<Files "manage">
require valid-user
</Files>
<Files "installpasswd">
require valid-user
</Files>
<Files "*">
allow from all
</Files>
Move the files to the webserver

Configure your FTP client to
transfer in ASCII mode files matching
*.;*.txt;v;*.pm;*.cfg;*.tmpl;.ht*;*.htm* This should cover all kinds of TWiki files that are not images or attachments.

Upload everything to the server, so that
index.html is placed in the
/home/your_account/your_domain directory level.
Prepare the server

In telnet, type these commands:
cd /home/your_account/your_domain
find . -print | xargs chmod go-w
cd bin
chmod u+rwx,g-w *
chmod go-rx *
Set up scheduled jobs
A note about crontab: The first 5 characters in the
crontab command 50 23 * * * (cd /home/your_account/your_domain/bin; ./statistics/Main -q) specify how often the command is run. The example here specifies
23:50 every night (server time). To choose another interval, please refer to this guide:
http://unixhelp.ed.ac.uk/CGI/man-cgi?crontab+5
Another note about crontab: If you're not familiar with
crontab or even Unix, then the
pico editor will be easiest for you to use. To prepare this, type this command before you type any
crontab command:
export EDITOR="pico -w"
Choice: If you don't want to use
WebNotify, then skip this step.
WebNotify is an e-mail sent to those who wish to subscribe to it, that contains a list of recent changes. The
WebNotify will be sent out at midnight every night (server time).

In telnet, type these commands:
export EDITOR="pico -w"
crontab -e
0 0 * * * (cd /home/your_account/your_domain/bin; ./mailnotify -q)
Ctrl-X (to exit crontab)
Y (to save changes)
Enter (to save changes)
exit (to close the telnet window)
Choice: If you don't want to run monthly usage statistics, then skip this step.
WebStatistics for each web can be useful to determine popular pages and top contributors.
Note: repeat the
statistics line for each web in your website. The
WebStatistics will be updated at 23:50 every night (server time).

In telnet, type these commands:
export EDITOR="pico -w"
crontab -e
50 23 * * * (cd /home/your_account/your_domain/bin; ./statistics/Main -q)
50 23 * * * (cd /home/your_account/your_domain/bin; ./statistics/TWiki -q)
Ctrl-X (to exit crontab)
Y (to save changes)
Enter (to save changes)
exit (to close the telnet window)
Check the finished setup

In a browser, visit
http://your_domain.example.com/bin/testenv/foo/bar and verify that there are no errors. You will notice the following:
- There is a red warning that your CGI scripts are executing as a certain user and that you need to change the locks on the files. To fix this, click the link to relock the files to your user name: http://your_domain.example.com/bin/manage?action=relockrcs
- If you're prompted for a login and it fails, then skip this step until you've registered as a user.
- There is a red warning that
$templateDir should not be writable by the your_account user. You can safely ignore this.
- If anything else is written in red color, then ask for help in the TWiki support community: TWiki:Support/WebHome.

In a browser, visit
http://your_domain.example.com/TWiki/TWikiRegistration and register as
YourName (ref. the
TWikiAdminGroup above) and finish up by editing
TWikiPreferences etc.

Does your setup work now?
Other comments
htaccess in Notepad
Normally, Notepad won't allow you to save a file named just
.htaccess because Windows requires a filename before the period. If you try to save the file as
htaccess then you will end up with
htaccess.txt and that won't work. The trick is to use quotes:
".htaccess" when you save the file.
Go back up to the part about creating
.htaccess files.
References
This cookbook is based on other work:
- TWiki:Codev/DreamhostSetupNotes
- For international support: http://twiki.org/cgi-bin/view/Codev/GermanUmlauteBreakWikiWords#Follow_up
- See more comments here: http://twiki.org/cgi-bin/view/Codev/TWikiOnWebHostingSites#Dreamhost
Only if using the HobbesSkin
I know I have not mentioned copying a few files to the site, like
HobbesSkin? *,
TigerSkin? *,
WebMenu? *, *PersonalizedMenu*,
SessionPlugin? *, and their associated files from pub/ and lib/.

You can ignore this if you don't use the
TWiki:Plugins.HobbesSkin.
Torben's sandbox
Note: This is experimental: InstallTwikiOnDreamhostWithoutBinDirectory?