Installation

Preparation

First make sure you have the dependencies installed and working.

Compile COCANWIKI itself

Type make all install (you don't need to be root).

Updating the Apache configuration

Modify your Apache configuration, adding:

 AddDefaultCharset utf-8
 
 CamlLoad ...path/to/html/_bin/cocanwiki.cma
 
 <VirtualHost your.server>
       ServerAdmin you@example.com
       DocumentRoot ...path/to/html
       ServerName your.server
       Include ....path/to/conf/cocanwiki.conf
 </VirtualHost>

(Change your.server to a suitable local server name, and set the paths as appropriate). This seems to be a little tricky. Because of that I uploaded my debian pre-3.1 (sarge) configuration for apache2 apache2-concanwiki.tar.bz2.

Please be aware that in order to use apache2, you have to compile concanwiki-1.3.8 and mod_caml-1.3.4 on your own. You also have to patch and recompile Apache2.

Creating the database

Create a UNICODE (createdb -E UNICODE) PostgreSQL database called cocanwiki.

If you're using PostgreSQL >= 8, have a look at these installation notes.

Install tsearch2: Make sure you have the PostgreSQL contrib package installed, which contains tsearch2, and find the file tsearch2.sql. If using PostgreSQL <= 7.4 you may wish to apply this patch to the tsearch2.sql file. Then load the (optionally patched) tsearch2.sql schema into the cocanwiki database.

You normally want to adapt the tsearch2 text search engine to your language. For this you should really read the tsearch2 introduction. At this point you should come across the problem of finding out the (global) locale of your postgres installation. I succeeded with a simple # less /var/lib/postgres/data/global/pg_control. First, you have to add a new configuration row for specific locale into the pg_ts_cfg table, as described in the tsearch2 doc. For language adaption you need 3 additional files: a worldlist (for example from debian wamerican package), an affix file (for example from debian iamerican package), and a stop file (for example from debian postgres-contrib). For debian the most import SQL statement reads like this:

INSERT INTO pg_ts_dict 
(SELECT 'en_ispell',dict_init,
'DictFile="/usr/share/dict/american-english",'
'AffFile="/usr/lib/ispell/american.aff",'
'StopFile="/usr/share/postgresql/contrib/english.stop"',
dict_lexize
FROM pg_ts_dict
WHERE dict_name = 'ispell_template'); 

you can test the correctness of this step by invoking the function lexize with the newly created dictionary as a first argument:

 SELECT lexize('en_ispell', 'This is a senctece');

Then you need to bind the configuration with the dictionary by performing set of inserts into the pg_ts_cfgmap, as described in mentioned documentation.

You may need to create a database user called www-data. The database schema assumes that the webserver is running as this user, and hence this user should be able to access and update the database.

 createuser -a -d www-data

Finally load the schema from cocanwiki.sql. You may see some errors from redefined tsearch2 functions.

Create a Wiki site automatically (only for cocanwiki versions >= 0.9.0)

Start up Apache and go to http://your.server/_bin/admin/create_host_form.cmo

Fill in the server name and Wiki title. Leave 'aliases' blank (for now). Click 'Save'.

OR Create a Wiki site in the database manually

Create a Wiki site by hand in the database:

 begin work;
 set constraints "hosts_hostname_cn" deferred;
 insert into hosts (canonical_hostname) values ('your.server');
 -- HOSTID is the value of hosts.id, normally 1
 insert into hostnames (hostid, name) values (HOSTID, 'your.server');
 commit work;

Create an index page by hand in the database:

 insert into pages (hostid, url, title, description) values (HOSTID, 'index',
   'My New Wiki', 'My New Wiki');

Check it works and troubleshooting

Try connecting to the local server using your browser. If it doesn't work, look in the Apache error_log file.