view · edit · print · history

MediaWiki for Unslung

"Instant wiki, just add slug"

For full documentation see: http://wikipedia.sourceforge.net and http://mediawiki.org - there is also some info on http://meta.wikimedia.org but this is in the process of being moved.

How to install

These instructions assume that you have not run mediawiki on your slug before; for information on how to remove a mediawiki installation see below.

To set up mediawiki on an nslu2 running Unslung, do the following:

  • Run ipkg update to make sure ipkg knows all about the state of the feeds.
  • Decide whether to use Apache or php-thttpd


  • If you do not already have it, install mysql:
    1. ipkg install mysql
    2. (Optional) You may wish to edit /opt/etc/my.cnf at this time.
    3. (Optional) You might also want to set a root password for your mysql configuration. When you install mysql for the first time, a message will be displayed telling you how to do this. If you edited my.cnf at the previous stage and enabled network access to mysql, then you MUST set a password; likewise if you plan to use mysql for anything other than mediawiki, or if anyone has shell access to your slug who does not also have sysop access to your wiki.

      If you forget your MySQL root password, look in the MySQL section for instructions on how to reset it.

[Comment] micwarr I had to run the following command to get mysqladmin to work

  1. ln -s /opt/lib/mysql/libmysqlclient.so /lib/libmysqlclient.so.14


You should choose Apache or php-thttpd or lighttpd. Having more than one of them installed will be messy.

  • If you do not already have them, install apache and php:
    1. ipkg install php-apache (eaccelerator is optional, but highly recommended)
    2. If apache or php ask you whether you want to replace your existing configuration files, and you don't know what this means, say (Y)es.
    3. Make sure apache has restarted by running /opt/etc/init.d/S80apache
    4. Apache should now be running on your slug on port 8000: check that it is by navigating to with a web browser (assuming the IP of your slug is You should see a generic greeting from apache.
    5. (Optional) You might now want to edit /opt/etc/apache2/httpd.conf to move your web server to the customary port 80. If you do that, you will also have to disable or reconfigure the slug's built-in thttpd.
    6. (Optional) Now is a good time to install phpMyAdmin, if you want lower-level access to mysql. If you install phpMyAdmin, you MUST set a root mysql password. Don't worry, you can do this with phpMyAdmin itself. See the phpMyAdmin page for details.


You should choose Apache or php-thttpd or lighttpd.

  • If you do not already have them, install php-thttpd and php:
    1. ipkg install php-thttpd


You can also use lighttpd with PHP via FastCGI. It's fast and easy. See DeployPHPWebAppUsingFastCGI for how to change the configuration of lighttpd to support fast-cgi and php. I also changed lighttpd.conf thus: server.username="nobody" server.groupname="nobody". This needs chmod a+w /opt/var/log/lighttpd/* Still I was unhappy with the many php-fcgi instances, but using externally spawned php-fcgi helps to reduce them to 3 at least. Besides, all works well. Mediawiki's install script does not identify eAccelerator (for me, v0.9.5.2 came with php-fcgi 5.2.4), but I didn't bother; also, compression could improve performance (?), but I also didn't spend time on that. Will have to see how this compares against using apache in terms of speed and consumed resources.


  • Produces error during initial setup: Notice: Undefined index: SERVER_ADMIN in /opt/share/www/mediawiki/config/index.php on line 338 (no matter which webserver you use) - appears to be harmless

[Comment] micwarr To get php running under Apache, I needed to add this line to httpd.conf:

  1. Include etc/apache2/conf.d/php.conf


  • Install mediawiki
    1. ipkg install mediawiki
    2. Navigate with your web browser to (assuming your slug's IP number is, and that apache is still set up on port 8000), and fill in the form.

[Comment] Lee At this point, I get:

You don't have permission to access /mediawiki/config/index.php on this server.

I have tried changing ownership of the mediawiki to nobody (which I think is the user apache runs as). I have also tried changing ownership of the entire /opt directory to nobody but that does not alter this message.

Any clues?

Hi Lee, I have faced the same problem. It occurs, because we are trying to access the wikiserver from some other client (not the localhost). and in /etc/httpd/conf.d/mediawiki.conf only the localhost is allowed to access config directory. change / add your clients IP in /etc/httpd/conf.d/mediawiki.conf allowed list and restart apache. it should work.

Cheers Parminder

  1. Mediawiki may offer to enable EAccelerator or Turck support. Don't enable this. It works, but will actually make mediawiki slower by increasing memory consumption.
  2. If you set a mysql root password, enter it in the DB root password field.
  3. Click "install" and wait until you see the "Success!" message.
  4. Move the mediawiki configuration into place: cp /opt/share/www/mediawiki/config/LocalSettings.php /opt/share/www/mediawiki/
  5. Set the permissions on the configuration file: chmod 0644 /opt/share/www/mediawiki/LocalSettings.php
  6. (Optional) For security, delete the config directory from the mediawiki distribution: rm -rf /opt/share/www/mediawiki/config
  1. Your mediawiki configuration is now ready: navigate your browser to to begin using it.

How to uninstall

You can remove the mediawiki software from your system in the usual way: ipkg remove mediawiki. However, that will leave three things behind:

  • The mediawiki configuration in /opt/share/www/mediawiki/config/LocalSettings.php.
  • Possibly, an uninstalled mediawiki configuration stored in /opt/share/www/mediawiki/config/LocalSettings.php
  • The wiki data itself, which is stored in a directory under /opt/var/lib/mysql. The name of this directory depends on the answers you filled in the forms when you configured mediawiki for the first time; with the default settings, it would be in /opt/var/lib/mysql/wikidb

If you want to totally delete all trace of a mediawiki installation from your system you must delete those files manually.

If you want to reconfigure an existing mediawiki:

  1. rm -f /opt/share/www/mediawiki/LocalSettings.php
  2. rm -f /opt/share/www/mediawiki/config/LocalSettings.php
  3. Reinstall mediawiki with ipkg install mediawiki -force_reinstall
  4. Navigate your browser to and follow the prompts.


Anyone tried the cherokee with php-fcgi setup? see DeployPHPWebAppUsingFastCGI

If you are not sure if to use MediaWiki or DokuWiki there is a useful comparison at wikimatrix dot org.

Error; PHP-files are downloaded instead of run In a configuration with Unslung 6.8beta and Apache I had to add te following lines to /opt/etc/apache2/httpd.conf to get the PHP code running:

  • LoadModule php5_module libexec/libphp5.so
  • AddHandler php5-script php
  • AddType text/html php
  • AddType application/x-httpd-php-source phps

Ofcourse without the bullets!

I also had to add index.php to the line 'DirectoryIndex index.html' thus making this line 'DirectoryIndex index.php index.html'

Now MediaWiki runs OK, still a bit slow though....

view · edit · print · history · Last edited by jp.
Based on work by fcarolo, case, carlb, Einstein1974, micwarr, Parminder, Glenn, Peter Enzerink, Brian Zhou, Lee Kimber, barrym, and jp30.
Originally by jp30.
Page last modified on September 06, 2008, at 02:22 PM