Introduction

This is a basic guide to installing multiple MediaWiki 1.7 wikis side by side on a Debian GNU/Linux system running Apache 2. It's for local reference at resonant.org and may or may not be particularly useful to other readers.

Relevant configuration files and locations

/etc/apache2/sites-available/wikis

This is where the main Apache2 configuration for the wikis will go.

/var/www/wikis

This is where the individual wiki directories will go. This directory should not already be in use by the webserver (i.e. it's for a system that places individual hosts in directories like /var/www/virtualhost.com/ and doesn't use /var/www/ directly -- if you do use /var/www/ directly, you need to pick another spot for this).

The naming convention is to pick the word that will be the URL path name to the wiki being created and prefix it with an underscore. For example, this wiki is accessed as http://wikis.resonant.org/mw/, so it lives in /var/www/wikis/_mw.

/var/www/wikis/_foo/LocalSettings.php

This is the actual final location of the settings for wiki foo. It will actually have to be moved out of the config subdirectory and slightly edited as a final step before the wiki can be used.

Setting up a new MediaWiki

System configuration

The first thing you will need to decide on is a name. For the sake of example, we'll pick the name foo. The first step is to create the directory for it:

mkdir /var/www/wikis/_foo

Once you have decided on a name and created its directory, you will need to symlink most of the files in the /usr/share/mediawiki1.7 directory into it, but recreate a few directories locally:

And now mod_rewrite rules to make the wiki accessible. The first line after the RewriteEngine command is to redirect the root page to whichever wiki you want to show up by default. In our case, it's this metawiki.

RewriteEngine on
RewriteRule ^/$ /mw/Main_Page [R]

And then RewriteRules for each wiki location -- add in the new name in the following format:

Now, if you have done everything right, you will be able to go to the configuration screen for your new wiki, using the name with the underscore, something like http://wikis.math.lsu.edu/_foo to get the MediaWiki configuration screen. If you fail to use the underscore, you will get a blank page with a prompt with a hyperlink stating "You'll have to set the wiki up first!". If you attempt to click on that link, it will probably break. Just go back and put the underscore back in.

MediaWiki initialization

Copyright/License Metadata

This is several options down, but there's a reason that I'm placing it at the top. If you choose a Creative Commons license here, you need to do so as your first step, as going through the selection screen will wipe out any other information you have entered on the configuration page.

As a general rule, if you are creating a private wiki, don't enter any license information at all (copyright law defaults to all rights reserved, which is probably what you want). If you are creating an open wiki, what you probably want is non-commercial, anyone can modify if they share alike. Further information on Creative Commons licensing can be found at the Creative Commons FAQ.

Site Name

Enter the WikiName of the site. This should be ideally an easily recognizable word with no spaces or special characters, using StudlyCaps to create a compound word. Don't use punctuation.

Sysop account name/password

Set the sysop account name to be whatever you're comfortable with. It's wiki-specific, unlike the database account below.

Shared memory caching

Select Memcached. Set the Memcached server to be localhost:11211

Database Config

Set the database name to be the file storage directory prepended with wiki, e.g. wiki_foo. Leave the wiki username to be wikiuser unless you want to use a different username for every wiki, which could eventually become a bit cumbersome. REMEMBER THE PASSWORD! -- if you use the username wikiuser and a password other than the standard password, it will change the password to the new value and break every existing wiki until it is corrected or the configuration files for all wikis using the wikiuser account are updated.

Don't set a database table prefix, and enter the MySQL root account password at the bottom so the script will have permissions to do its work. In theory, MediaWiki now supports PostgreSQL. I had no luck with either 7.4 or 8.1, so it seems best just to stick with MySQL, even if it means running two databases side by side.

Click Install, and the script will generate a configuration file for you in /var/www/wikis/_foo/config/LocalSettings.php. Copy this file into the parent directory and fix its permissions and ownership (it has a password in plaintext)

LocalSettings.php configuration

Set $wgScript to /foo/index.php
Set $wgRedirectScript to /foo/redirect.php
Set $wgArticlePath to /foo/$1
Set $wgLogo to whatever you want to use for you logo. The resonant.org logo is http://www.resonant.org/resonance-trans-64.png — unfortunately, it doesn't really work perfectly on a white background, so some retheming may eventually be in order.

Privacy Settings

If you need to restrict access, you can disable new account registration except by Sysops, make an account required to edit (highly recommended to cut down on anonymous spamming), or make an account login required to view all but a selected list of public pages. For full details see MetaWikiPedia:Preventing_Access.

To enable the settings, below the first batch of =$wg= settings, you can paste in any or all of the following blocks, commenting out whichever ones you don't want to be true by prepending '#':

This has just generated the standard WikiPedia and MetaWikiPedia Interwiki entries, so you can cut and paste from those sites, or redirect to them transparently. (Note: I had some problem with the meta: prefix even after this, though m: worked just fine.)

!!Final configuration

Log into the wiki as the Sysop account by using the Log In link at the upper right of the page. Usernames are not case sensitive (and in fact, the first letter will always end up capitalized after you log in). Now is a good time for you to create your own account and give yourself full permissions. Click on Special Pages at the lower left, then click on the first link, Create an account or log in. If you are creating an account for yourself, type in your username, your password, e-mail and real name, then click the Create new account button. If you are creating an account for someone else, fill in all of the data except the password, then click by e-mail. A random password will be generated and mailed to the e-mail address specified as the account is created.

If you created the account for yourself, you will have suddenly had the disadvantage of being logged into that account... without your Sysop privileges. Log out, and log back in as the Sysop account. Go back to the Special Pages link, then scroll all the way to the bottom to select User rights management. Type in your username, and select Sysop and Bureaucrat permissions (this allows the account to not only administer the wiki, but create other sysop accounts), and click the Save Usergroups button. Note that while the login screen is not case sensitive, this page IS case sensitive. Make sure the first letter is capitalized. Log out and back in as your own, freshly Sysoped account and create any other user accounts and promote them as needed.

Now it is time to set up redirects in the help pages, which start out blank. Click *Help* on the left sidebar, which will bring you to the *Help:Contents* page. Edit this page, and add the following line:

#Redirect [[m:Help:Contents]]

Before you save the page, middle-click Editing Help down at the bottom to bring it up in a new window. You will want to edit it next. Then save the page.

Go to the Help:Editing window you just brought up and edit that entry as well, adding the line:

#Redirect [[m:Help:Editing]]

If you didn't use the Interwiki entries as suggested above, you will have to use [[MetaWikiPedia:Help:Contents]] and [[MetaWikiPedia:Help:Editing]] respectively, and instead of being directly sent to the [MetaWikiPedia help pages|MetaWikiPedia:Help:Contents], you will be shown a redirect page with one more link you will have to click on to go there.

Once this is done, the Wiki is ready for use. If you are also running a MetaWiki, you may want to add a link there to your new wiki.