Kevin's Game
Installing MediaWiki (and PHP5 and MySQL)

While this blog’s useful for documenting pitfalls and successes, a wiki can be updated a lot easier than this blog and can keep information much more organized. So, logically, I’ve decided to set up a wiki! My plans for this blog haven’t changed, instead I’ll likely link directly to the wiki (if I decide to make it open to the world).

I’m going with MediaWiki. Mostly because I’m somewhat familiar with it, having set it up in the past. I’ll be hosting it on my Mac Mini out of my apartment (at least for now) to keep expenses low, since I don’t expect a large amount of traffic. I haven’t decided if I’ll make it open to the world. I probably will, but that involves spending time hardening it.

To set up MediaWiki, I had to install php5 and mysql. I already had ports and Apache2 installed, so I used ports:

sudo port install php5 +mysql

I also had to modify httpd.conf, adding index.php as a DirectoryIndex:

DirectoryIndex index.php index.html

Telling it to toss .php files to the php processor:

<FilesMatch .php$>
SetHandler application/x-httpd-php
</FilesMatch>

And add the php5 module to the module list:

LoadModule php5_module        modules/libphp5.so

Next, I set up MySQL:

First I initialized the MySQL databases:

sudo /opt/local/lib/mysql5/bin/mysql_install_db --user=mysql

Next, I told mysql to start at boot by changing the RunAtLoad variable to true in the mysql5.plist:

sudo vi /Library/LaunchDaemons/org.macports.mysql5.plist

And added the plist to launchctl:

sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist

And rebooted OSX to start up the mysql server (since it wasn’t installed before). I’m sure this can be done without rebooting, but I also wanted to make sure it came back up with the machine. I also may have been able to do this without a few of those steps, but I had to do a bit of trial-and-error and google searches to get it to work

Next, I downloaded MediaWiki into /opt/local/apache2/htdocs/wiki, navigated to http://server/wiki, and ran the configuration script. The wiki was then up and running.

I then did some basic hardening with the config files. Nothing too fancy (since I won’t put anything sensitive on the wiki), but I made it so only admins can create users, and only users can create/edit pages. This is my personal wiki, so I don’t want unknown others messing around. :) To do this, I added the following to LocalSettings.php in my wiki folder:

$wgGroupPermissions[‘*’][‘createaccount’]    = false;
$wgGroupPermissions[‘*’][‘edit’]             = false;
$wgGroupPermissions[‘*’][‘createpage’]       = false;
$wgGroupPermissions[‘*’][‘createtalk’]       = false;
$wgGroupPermissions[‘*’][‘writeapi’]         = false;
$wgGroupPermissions[‘autoconfirmed’][‘autoconfirmed’] = false;