home   articles   archive   forum   masthead  
Published at 8.08.05
Author: Lars-Anders Schmuhl
Translator: Sebastian Kueppers
Languages: de
Printer printer-version
Support Us!
  Warning: This article needs a proof reader.

Veni, Vedi, Wiki

Nowerdays wikis are available as there is sand at the seashore. A point of differentation is the language it is coded in. As for MoinMoinWiki [1] this is Python. The current stable version 1.3.1 has been released recently. This article will describe installation and configuration on a Knoppix 3.6 (debian) system.

Wiki? - What's that?

Wikis belong to the family of content management systems (CMS). Similar to WebServers they provide information in a network environment. Other than for web servers wiki-user can edit, enhance or correct entries. Wikis are implemented as CGI-extension for web server.
Wikis are open. This weakness is again their greatest advantage. In intranets they help to manage project-specific information for example.
"Wiki wiki" is hawaiian for "fast". This name is promise: Information can be spread by different users easy and fast. For companies a rather important fact beacuse - as you probably know - "time is money".

Which Wiki to use?

There are lots of wiki-engines available (see [3]). Most of them are open source. A important point of differentation is the language the wiki-engine is coded in (Perl, Java, PHP, LISP, Python, Ruby, ...). I chose Python because it is used as "glue-language" integrating different components (C++, CORBA, XML, ...) through its open API. Additionally MoinMoinWiki provides the possibility to extend its functions with macros (written in Python). How this is done we'll talk about later.

Prerequirements

For installation I presume you to:

  • have root priviledges on the computer
  • have a running web server (here Apache [4] is used)
  • be the webadmin
  • have enough free disk space. After installation about 16MB are needed. Depending on the amount of data and given options (add attachments for example) the wiki can become rather big
  • have installed Python
  • have installed the Python distutils

At first you should download the latest stable version at http://moinmoin.wikiwikiweb.de/MoinMoinDownload. From now on you should work as root. Now unpack it and change to the packet directory
   # tar -xzf moin-1.3.1.tar.gz
   # cd moin-1.3.1
  
The installation is explained well in moin-1.3.1/INSTALL.html.
As prerequisite Python [2] including the distutilsfrom the Python development package have to be installed. To see if Python is installed correctly this command should work without errors:
   # python -V
   Python 2.3.4
  
To see if the distutils are installed correctly this should work, too:
   # python -c 'import distutils'
  
Now you should think of where you want to install the wiki to. Without settings it will be installed to
   # python -c 'import sys; print sys.prefix'
   /usr
  
As for me I prefer /usr/local so I use the option --prefix=/usr/local.

Installation

The installation is done by:

   # python setup.py install --record=install.log --prefix=/usr/local
   running install
   [...]
   writing list of installed files to 'install.log'
  
Which file has been copied where (to /usr/local/lib, /usr/local/bin und /usr/local/share) you can read in the install.log file.
If nothing went wrong this command should work without errors:
   # python -c 'import MoinMoin'
  

Instantiating the wiki

After installing the next step is to create a wiki instance. Several instances can be run parallel. Important is a unique name for each instance. The name can be something like the project topic or division name but NOT "wiki" as this name is used internally. I'll use "MatrixWiki" for testing.

Next a place providing enough space (see above) has to be choosen.

Also some additional information have to be collected.

Those we can remember temporaly using the shell:

   # export PREFIX=/usr/local
   # export SHARE=$PREFIX/share/moin
   # export WIKILOCATION=$SHARE
   # export INSTANCE=MatrixWiki
  
We also need to know which user and group the webserver is run with. This differs from distribution to distribution. On Knoppix (Debian) it looks like this:
   # egrep "^User|^Group" /etc/apache/httpd.conf
   User www-data
   Group www-data
  
using SuSE linux like this:
   # egrep "^User|^Group" /etc/httpd/httpd.conf
   User wwwrun
   Group nogroup
  
Both provide Apache as standard webserver.
We memorize that, too:
   # export USER=www-data
   # export GROUP=www-data
  
Now the wiki instance can be created by copying:
   # cd $WIKILOCATION
   # mkdir $INSTANCE
   # cp -R $SHARE/data $INSTANCE
   # cp -R $SHARE/underlay $INSTANCE
   # cp $SHARE/config/wikiconfig.py $INSTANCE
  
In the next step the file permissions have to be changed so only the webserver can change files.
   # chown -R $USER.$GROUP $INSTANCE
   # chmod -R ug+rwX $INSTANCE
   # chmod -R o-rwx $INSTANCE
  
The last step is to configure this instance by editing $INSTANCE/wikiconfig.py. Things that should be changed are:
   sitename = u'Matrix Wiki'
   default_lang = 'de'
   allowed_actions = ['DeletePage', 'AttachFile', 'RenamePage']
  

Webserver configuration

To make the wiki work we have to configure the webserver. Installing apache is not described here. Firstly the moin.cgi script - connection point between webserver an wiki - has to be copied

   # cd $WIKILOCATION/$INSTANCE
   # mkdir cgi-bin
   # cp $SHARE/server/moin.cgi cgi-bin
   # chown -R $USER.$GROUP cgi-bin
   # chmod -R ug+rx cgi-bin
   # chmod -R o-rwx cgi-bin
  
and following lines have to be edited:
   import sys
   sys.path.insert(0, '..')
  
to ensure the wikiconfig.py can be found..

Now add following lines to the apache configuration in /etc/apache/httpd.conf:


   # echo "" >>/etc/apache/httpd.conf
   # echo "Alias /wiki/ \"$SHARE/htdocs/\"" >>/etc/apache/httpd.conf
   # echo "ScriptAlias /MatrixWiki \"$WIKILOCATION/$INSTANCE/cgi-bin/moin.cgi\"" >>/etc/apache/httpd.conf
  
The first line is needed once only, the second line is needed for once for every instance.
At last the directories given in wikiconfig.py have to be set correctly (relatively to the cgi-script).
   data_dir = '../data/'
   data_underlay_dir = '../underlay/'
   url_prefix = '/wiki'
  

The first start

At first you have to restart the webserver so he rereads his configuration. How this is done depends on the used distribution. On Knoppix (Debian) this works:

   # apachectl restart
  
Now the Wiki can be accessed via http://127.0.0.1/MatrixWiki on the local host (fig. 1) or via http://192.168.1.2/MatrixWiki (fig. 2) over my LAN.


fig. 1 - The first start

MoinMoinWiki works multilingual. In figure 1 the texts are english, but that can be changed personalizing the wiki and setting the browser to the prefered language. (fig. 2).


Fig. 2 - Wiki in german

Wiki on duty

personalize

Following the "Login" link you can create an account with name and password (Fig. 3) to save your settings (Fig. 4).


Fig. 3 - Create user


Fig. 4 - user settings

Sandbox

For your first tries you can use the "wikiSandbox" (Fig. 5).


Fig. 5 - WikiSandbox

Every wiki-page can be edited (there is an option to save specific sites from being changed). You only have to follow the "edit" link, perform your changes and save them. Before saving you can have a look at a preview to check your changes. But before starting to edit you shuld learn the wiki syntax.

MoinMoinWiki Syntax

The syntax used by this wiki is an eased up version of HTML:

MoinMoinWiki Syntax
MoinMoinWiki-Syntax HTML-Syntax View
''italic'' <em>italic</em> italic
'''bold''' <b>bold</b> bold
##Comment <!-->Comment<--> nothing shows up
[[BR]] <br> line break
empty line <p> paragraph
= Headline 1 = <h1>Headline</h1>

Headline 1st level

== Headline 2 == <h2>Headline</h2>

Headline 2nd level

=== Headline 3 === <h3>Headline</h3>

Headline 3rd level

==== Headline 4 ==== <h4>Headline</h4>

Headline 4th level

===== Headline 5 ===== <h5>Headline</h5>
Headline 5th level
---- (four dashes) <hr> horizontal line



These commands differ from wiki to wiki but it is always shorter and easier than HTML not to annoy users with too many formalisms. The content is the important! The Wiki contains a section for help where all commands are listed. The table above shows only an excerpt from this list.
Words edited in "CamelCase" led the wiki to automatically create an internal link to this page. If this site does not exist it will be created. This is supportes by templates.

Macros

A special pro of MoinMoinWiki is the possibility to use macros. Those macros are Python scripts which can be integrated into the page and will be executed on opening this site. Using macros is as easy as that:

   [[MacroName]]
  
Macros can be found in the Internet [1] or be written by oneself. A very short macro look e.g. like that:
   # MyMacro
   
   from MoinMoin import wikiutil
   
   def execute(macro, args):
  	return macro.formatter.text("I got these args from a macro %s: %s" % (str(macro), args))
  
Simply copy it to $SHARE$INSTANCE/data/plugin/macro/. They will automatically be identified by the Wiki . At http://matrix/MatrixWiki/SystemInfo information about the wiki-system can be found. Also installed macros are listed there. How macros work you can see in Fig. 6 and 7.


Fig. 6 - Macros in Edit-Mode


Fig. 7 - Macros on duty

Internal

Pages as well as their complete history can be found at $SHARE$INSTANCE/data/pages. For every page in the wiki there is a corresponding directory containing all information to the history (who changed what when). The information can be displayed in the wiki itself, too, and you can roll back to any older version. Some wikis use RCS or SQL-databases for that. MoinMoinWiki only uses ASCII files for saving and does not need any further tools for version control.

Conclusion

There is still a lot to say about wikis in general and MoinMoinWiki in special. The wiki concept is quite effective and used on the web for a long time now (see [1], [3] and [6] for example). It is very powerful in intranets. A tool to collect information, administrate them and spread them to the users again. I run a MoinMoinWiki in a bigger company on an old-fashioned computer providing some rare ressources (Pentium II 400MHz, 64MB RAM, 4GB HDD). The user count is about 50 - 100 persons. As for me I only had good experiences, yet.


Links:



Talkback Area




Enter Own Comment