Setting Up a MediaWiki Server in OS X

(One pseudo-geek’s experience)

This page is not intended to be a definative set of step-by-step directions for setting up a wiki. Basically, these are notes to myself for how I set up the MediaWiki software on a local server.

However, I hope they help if you are trying to do the same thing. I’m working on a Mac G4 running OS X but the process will be the roughly the same for Windows, Linux, or most any other box you happen to have.

Incidently, many web hosting companies provide support for PHP and MySQL as standard parts of even the lowest priced plans. If that’s the case with yours, it won’t be difficult at all to install the MediaWiki software.

A side benefit to all this is that I am also able to run a WordPress blog on the same computer, since that software uses PHP and MySQL as well. Just skip everything down to here.

getting the pieces

For the computer I’m using a Mac G4 with 512mb RAM, 80gb hard drive, running OS X 10.3.9. Most of the software packages I used require 10.3.x.

For the software, I downloaded and installed four packages. All of these pieces are free and based on open source projects.

Apache 2 package from Server Logistics

Although Mac OS X comes with Apache, I installed this version because the same company produces companion packages for PHP and MySQL that requires the use of this version of Apache. Server Logistics has set this and the other two software up using the standard Apple installer making it very easy. If you’re using Windows or another OS, see the section below for obtaining the necessary software.

Complete PHP Install from Server Logistics

Complete MySQL Install from Server Logistics

As with the Apache 2 package, these two installs were double-click simple. My SQL requires an extra step to initialize the database but that’s as easy as opening the System Preferences.

phpMyAdmin

This piece is not really necessary as long as you understand how to manage a MySQL database from the command line. I don’t. Fortunately, this package is both free and easy to install as well.

wikiMedia

Finally we get to the piece that uses all that other stuff to create the wiki. It too is easy to install and set up.

Before you begin

Make sure you have a couple of hours of uninterrupted time to do this. It shouldn’t take that long but there are always little glitches that can pop up. None of this is complicated but if you miss a step, you may have to throw everything out and start over. At least, I wasn’t able find a way to fix a couple of errors I introduced into the process. You may be able to find better solutions

If you’re planning to do this on a local machine as I did, ask your tech support people for a fixed IP address for the computer. Since the URL people will use to access the wiki is based on the IP address, you don’t want to have it changed if the dynamic address changes.

Open the System Preferences, click on Sharing and turn off Personal Web Sharing. That piece uses the built-in Apache software and you can’t have versions 1 and 2 both running at the same time.

Installing the packages

Complete Apache 2 – Read and follow the very brief directions in the install guide.

Complete PHP – Read and follow the very brief directions in the install guide.

Complete MySQL – Read and follow the very brief directions in the install guide. Make sure you don’t miss the part about initializing MySQL the first time. I did, and trying to use the admin program without having a database running is frustrating (not to mention stupid).

DON’T however, follow the directions to set the root password at this point. The wikiMedia software seems to expect to find the default password when it starts.

phpMyAdmin – After unzipping the package, rename the folder phpmyadmin and drag it into the htdocs folder inside the Apache 2 folder (follow this path: your hard drive –> Library –> Apache 2 –> htdocs. You could also put the folder in the Servers folder inside your account folder but that will lengthen the address people will use to access the wiki to include your login ID for the computer, which is not something I wanted to do. You can now administer your MySQL databases by going to this address: http://ipaddress/phpmyadmin/index.php.

wikiMedia – Do the same for this package, changing the name of the folder to wiki (or whatever you want to call this project).

Configuring the Wiki

Open your browser and enter the address for the wiki: http://ipaddress/wiki/index.php (or whatever you called the wiki folder). The page you get will have a simple link to the config page. DON’T CLICK that link yet. You need to tell the system that the folder can be modified.

Open the Terminal program (found in Applications –> Utilities). At the command line type this on one line exactly as you see it [space after 777]

chmod -R 777 /Library/Apache2/htdocs/wiki/config

(replace wiki with the name you gave the wiki folder)

After you hit Return it may ask for your password. Enter the system password associated with this login.

Now click on the config link. You will get a page that will ask for some basic information. Don’t lose the passwords, especially for the WikiSysop since that is the all powerful account allowing you full control over the wiki.

Don’t click the link to go to the wiki quite yet. First, open the wiki folder and then open the config folder. Copy the file LocalSettings.php from the config folder to the main wiki folder.

Now you can go to the wiki and begin playing.

One small problem

If someone tries to visit your wiki and forgets to type the index.php at the end of the address (http://ipaddress/wiki/), they will see a directory for the folder. If they click on the link for index.php, all will be fine. However, a list like this will confuse many people.

By default, Apache sends people to index.html. As a work around, I created an HTML page that was nothing more than a redirect to the PHP page. It takes a couple of seconds longer to connect but the delay was not a big deal.

To make a permanent fix you’ll need to edit one of the files that came with Apache. Find the Apache files (probably in the Library folder) and open the conf folder.

Open the file httpd.conf in a text editor (NOT a word processor). Find the line that starts DirectoryIndex and add index.php to the list of pages. After the line should look like this:

DirectoryIndex index.php index.html index.html.var

Save the file and restart Apache.

Windows and other OS

If you are using Windows, Linux or another OS to host your wiki, you will still need to have Apache, PHP and MySQL installed. I’ve included the links below where you can find that software for your platform.

Read the pages for these downloads carefully so you get the right files. You want binary files not source code and never try to use any alpha versions.

Also, read the instructions. I’ve never used the Windows or Linux versions so I have no idea if the install is as easy as the Mac version.

Apache (web hosting software)

PHP

Most current Linux installations come with PHP built-in so this site has no Linux files.

MySQL

The phpMyAdmin and wikiMedia packages use PHP and so the files from the URLs listed earlier will run on any platform with PHP and MySQL installed.