Table of Contents

MonkeyWiki Installation

See also: MonkeyWiki

Setup Notes

Because of how Monkey Wiki formats things, please look at the source code for this page (edit the page) to see all the values / configuration information. There is no way to “escape” the data so it renders correctly.


1. yum install httpd

chkconfig --list
chkconfig httpd on

2. Create a separate configure file

vi /etc/httpd/conf.d/wiki.conf

<VirtualHost *:80>
    ServerName wiki.kb0odu.pvt
    DocumentRoot /var/www/wiki/script/
    <Directory /var/www/wiki/script/>
        Options +Indexes +MultiViews +FollowSymLinks +Includes +ExecCGI

        Order allow,deny
        Allow from all
        AllowOverride All
    </Directory>
    ErrorLog /var/log/wiki/wiki-error.log
    CustomLog /var/log/wiki/wiki-custom.log "%h %l %u %t \"%r\" %>s %b"
</VirtualHost>

3. Create directories

mkdir -p /var/www/wiki/script
mkdir /var/log/wiki
service httpd restart

test simple .html in browser : http://wiki.kb0odu.pvt/ OK, testing page displays

4. Create the .htaccess file

Options -Indexes +ExecCGI +FollowSymLinks
AddHandler cgi-script .py 
DirectoryIndex index.py

<Files ~ "^.htaccess$">
    Order allow,deny
    Deny from all
</Files>

test simple .py in browser : http://wiki.kb0odu.pvt/ OK, testing page displays

5. Download monkeywiki

cd /var/www/wiki/script
wget http://www.waywood.co.uk/cgi-bin/monkeywiki.py
chmod 705 monkeywiki.py

6. config monkeywiki

Following values are being used:

#==CONFIGURATION SECTION=======================================================
PATH_TO_WIKI_TEXT = '/home/wiki/'
PATH_TO_TEMPLATES = '/home/wiki/template/files/'
FRONT_PAGE = 'FrontPage' #required, must be WikiName. (= name of 'top' or 'home' page)
NOFOLLOW_OUTLINKS = 1
NUMBERED_OUTLINKS = 0
REWRITE_MODE = 1
REWRITE_BASE_URL = ' '
EDITABLE = 1
BACKUP_ON = 0 #use the backup feature? (backups are done by email)
SMTP_SERVER = 'localhost'
WIKI_LOGGER = ' ' #email address from which backups are sent
WIKI_MASTER = ' ' #email address to which backups are sent
CREDIT = 'Site powered by <a href="http://www.waywood.co.uk/MonkeyWikiInstallation/">MonkeyWikiInstallation</a>'
#==============================================================================

adding in following lines in .htaccess

(for REWRITE_MODE 1, it is not necessary, but nice to have if don't like it, we can set REWRITE_MODE 0, and remove the follwing lines from .htaccess)

    RewriteEngine on
    RewriteRule  ^/?$  /monkeywiki.py
    RewriteRule  ^(.+)\.html$  /monkeywiki.py?page=$1  [QSA]

    ExpiresActive on
    ExpiresByType text/html "modified"

7. Create the wiki directory

mkdir /home/wiki

Create a simple page:

    # cat /home/wiki/FrontPage
    This is a test...

And go to: http://wiki.kb0odu.pvt/FrontPage.html

wiki works, URL rewrite works also

8. Use simple authentication to make the wiki private to us

8a) make the password file

   mkdir /home/dba/wikiusers
   cd /home/dba/wikiusers
   htpasswd -c ./dbas dba   ==  to change password, run this command again

8b) update .htaccess

   vi /var/www/wiki/script/.htaccess

   AuthUserFile /home/dba/wikiusers/dbas
   AuthName "This is a protected area"
   AuthGroupFile /dev/null
   AuthType Basic
   Require valid-user

8c) optional: lock down local users for password access

   chmod 701 /home/wiki/wikiusers
   drwx-----x   2 root           root     4096 Jun 25 19:00 wikiusers

8d) Final .htaccess for this entire setup

   [root@db-mgmt01 script]# cat .htaccess
   AuthUserFile /home/wikiusers/users
   AuthName "This is a protected area"
   AuthGroupFile /dev/null
   AuthType Basic
   Require valid-user
   
   RewriteEngine on
   RewriteRule  ^/?$  /monkeywiki.py
   RewriteRule  ^(.+)\.html$  /monkeywiki.py?page=$1  [QSA]
   
   ExpiresActive on
   ExpiresByType text/html "modified"
   
   Options -Indexes +ExecCGI +FollowSymLinks
   AddHandler cgi-script .py
   DirectoryIndex index.py
   
   <Files ~ "^.htaccess$">
       Order allow,deny
       Deny from all
   </Files>

9. other permissions, this is where further changes may(or may not) need:

9a) web script directory /var/www

 [root@db-mgmt01 www]# ls -l
 total 20
 drwxr-xr-x 2 root root 4096 Oct 16  2014 cgi-bin
 drwxr-xr-x 3 root root 4096 Jun 25 16:19 error
 drwxr-xr-x 2 root root 4096 Oct 16  2014 html
 drwxr-xr-x 3 root root 4096 Jun 25 16:19 icons
 drwxr-xr-x 3 root root 4096 Jun 25 16:47 wiki

9b) actual wiki pages /home/wiki and /home/wikiusers

 [root@db-mgmt01 dba]# ls -l /home/
 total 24
 ...cut unrelated directories here...
         
 drwx---rwx 2 root           root     4096 Jun 25 18:40 wiki
 drwx-----x 2 root           root     4096 Jun 25 19:00 wikiusers