Creating a MediaWiki Development Environment

From wiki.occupyboston.org
Jump to navigation Jump to search

Creating a MediaWiki development environment

Obtaining the Source

mkdir wiki.occupyboston.org
cd wiki.occupyboston.org
git init
git remote add origin ssh://obwiki@boggs.mayfirst.org/home/members/occupyboston/sites/wiki.occupyboston.org/include/site_hub
git fetch origin
git checkout master

Here's what the result should look like.

$ ls
total 8
4 mediawiki/  4 robots.txt

The "mediawiki" directory will be your document root.

Setup a Virtual Host

Add an IP/hostname mapping to your hosts file (e.g., /etc/hosts). For example:

 127.0.0.1     obwiki.local

Add a virtualhost to your web server. For example:

 <VirtualHost localhost:80>
   ServerName obwiki.local
   DocumentRoot /PATH/TO/wiki.occupyboston.org/mediawiki
 </VirtualHost>

Initial Wiki Install

Go to http://obwiki.local; click "set up the wiki".

Go through the wiki installation process. I'll assume that you're using MySQL, a username of "obwiki", and a database name of "obwiki".

Don't worry too much about the initial configuration parameters. We'll set up the confgiuration in a subsequent step.

At the end of the installation, MediaWiki will ask you to save a LocalSettings.php file. Save this file as LocalSettings-install.php.


Configuration Setup

cd mediawiki   # this is the document root
cp LocalSettings-example.php LocalSettings.php

Now, edit LocalSettings.php. Fill in the values from LocalSettings-install.php.


Noteworthy Configuration Directives

If you'd like to use mod_rewrite, add the following to your webserver's virtualhost definition:

   RewriteEngine On
   RewriteRule ^/*$ http://obwiki.local/wiki/Main_Page [L]
   RewriteRule ^/?wiki/(.*)$ /index.php?title=$1  [PT,L,QSA]

If you don't want to use mod_rewrite, add this line to LocalSettings.php

 $wgArticlePath = false;

You may also want to add

 $wgUseSquid = false;


Additional Setup for Plugins

We enable several MediaWiki plugins, and some of these plugins require additional database tables. To install the additional database tables:

cd mediawiki
php maintenance/update.php

At this point, you should be able to create and edit pages in your development environment.


Miscellaneous Notes

If you'd like to look at boggs server configuration for wiki.occupyboston.org, you'll find it in ~obwiki/wiki.occupyboston.org/.red/apache2.

The live document root is ~obwiki/wiki.occupyboston.org/web/mediawiki/. Note that this is a checked out copy of git repository.