Ready-to-use server

MediaWiki

Wikipedia's Wiki Engine

MediaWiki screenshots

MediaWiki is a powerful wiki engine that was originally developed to serve the needs of Wikipedia - the free encyclopedia. Today, MediaWiki is used publicly by many of the largest and most popular wikis online, while privately it is being increasingly deployed inside company Intranets as a knowledge and content management system.

This appliance includes all the standard features in TurnKey Core, and on top of that:

  • MediaWiki configurations:

    • Installed from upstream source code to /var/www/mediawiki

    • Ensure clean and compliant HTML ($wgUseTidy)

    • Out of the box file uploading and image resizing (GD library)

      • Maximum filesize: 2MB

      • Supported file types: png, gif, jpg, jpeg

      Security note: Updates to MediaWiki may require supervision so they ARE NOT configured to install automatically. See MediaWiki documentation for upgrading.

  • SSL support out of the box.

  • Adminer administration frontend for MySQL (listening on port 12322 - uses SSL).

  • Postfix MTA (bound to localhost) to allow sending of email (e.g., password recovery, user registration)

  • Webmin modules for configuring Apache2, PHP and MySQL.

Customization details:

  • Site logo is located at /var/www/mediawiki/images/logo.png (recommended size: 135x135px).

  • Site name and administrative emails (set in /var/www/mediawiki/LocalSettings.php):

    $wgSitename = "";
    $wgEmergencyContact = webmaster@localhost;
    $wgPasswordSender = webmaster@localhost;

Credentials (passwords set at first boot)

  • Webmin, SSH, MySQL: username root

  • Adminer: username adminer

  • MediaWiki: username admin

Usage details & Logging in for Administration

No default passwords: For security reasons there are no default passwords. All passwords are set at system initialization time.

Ignore SSL browser warning: browsers don't like self-signed SSL certificates, but this is the only kind that can be generated automatically. If you have a domain configured, then via Confconsole Advanced menu, you can generate free Let's Encypt SSL/TLS certificates.

Web - point your browser at either:

  1. http://12.34.56.789/ - not encrypted so no browser warning
  2. https://12.34.56.789/ - encrypted with self-signed SSL certificate

Note: some appliances auto direct http to https.

Username for adminer:

Login as username adminer

Username for mediawiki:

Login as username admin

Username for database administration:

  1. Adminer; login as MySQL username adminer:

    https://12.34.56.789:12322/ - Adminer database management web app

  2. MySQL command line tool; log in as root (no password required):
    $ mysql --user root
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql>
    

Username for OS system administration:

Login as root except on AWS marketplace which uses username admin.

  1. Point your browser to:
  2. Login with SSH client:
    ssh root@12.34.56.789
    

    Special case for AWS marketplace:

    ssh admin@12.34.56.789
    

* Replace 12.34.56.789 with a valid IP or hostname.

Documentation

MediaWiki extensions

The following are notes for testing/using some of the MediaWiki extensions that can be used with the MediaWiki appliance.
Please refer to the extensions documentation for details, no point in repeating them here...

Please see the MediaWiki Extensions doc page for further info. There is a section related to installing extensions.

WikiEditor: full-featured MediaWiki-integrated text editor that adds enhanced text processing functions to edit pages.

WikEd: provides an (alternate) improved interface for editing wikitext.

Preloader: Populate new pages with template content depending on namespace

/etc/mediawiki/extentions.php is already seeded with the following MediaWiki private namespaces:

$wgPreloaderSource[ NS_MEDIA ] = 'Template:Media';
$wgPreloaderSource[ NS_SPECIAL ] = 'Template:Special';
$wgPreloaderSource[ NS_MAIN ] = 'Template:Main';
$wgPreloaderSource[ NS_TALK ] = 'Template:Talk';
$wgPreloaderSource[ NS_USER ] = 'Template:User';
$wgPreloaderSource[ NS_USER_TALK ] = 'Template:User_Talk';
$wgPreloaderSource[ NS_WIKIPEDIA ] = 'Template:Wikipedia';
$wgPreloaderSource[ NS_WIKIPEDIA_TALK ] = 'Template:Wikipedia_Talk';
$wgPreloaderSource[ NS_IMAGE ] = 'Template:Image';
$wgPreloaderSource[ NS_IMAGE_TALK ] = 'Template:Image_Talk';
$wgPreloaderSource[ NS_MEDIAWIKI ] = 'Template:Mediawiki';
$wgPreloaderSource[ NS_MEDIAWIKI_TALK ] = 'Template:Mediawiki_Talk';
$wgPreloaderSource[ NS_TEMPLATE ] = 'Template:Template';
$wgPreloaderSource[ NS_TEMPLATE_TALK ] = 'Template:Template_Talk';
$wgPreloaderSource[ NS_HELP ] = 'Template:Help';
$wgPreloaderSource[ NS_HELP_TALK ] = 'Template:Help_Talk';
$wgPreloaderSource[ NS_CATEGORY ] = 'Template:Category';
$wgPreloaderSource[ NS_CATEGORY_TALK ] = 'Template:Category_Talk';

edit the user homepage template

http://appliance_ip/index.php/Template:User

create new user page (template text will "preloaded")

CharInsert: JavaScript character insert boxes used on edit type pages

create the following:

http://appliance_ip/index.php/MediaWiki:Edittools

insert which ever charaters you desire (refer to MediaWiki's Edittools as a reference)

edit a page, the charaters will appear at the bottom of the page.

MediaWiki math rendering support

To enable the MediaWiki math rendering engine, perform the following steps:

Install the mediawiki-math package and a couple of other dependancies

apt-get update
apt-get install mediawiki-math texlive-latex-extra dvipng

Create the math image and temp directories and change ownership to the web server user

mkdir -p /var/lib/mediawiki/images/{math,tmp}
chown www-data:www-data /var/lib/mediawiki/images/{math,tmp}

Add the following to /etc/mediawiki/LocalSettings.php or /etc/mediawiki/extensions.php

# Math engine
$wgUseTeX = true;
$wgUploadPath = "/images";
$wgUploadDirectory = "images";
$wgMathPath = "{$wgUploadPath}/math";
$wgMathDirectory = "{$wgUploadDirectory}/math";
$wgTmpDirectory = "{$wgUploadDirectory}/tmp";

Enable the extension and update MW DB

mwenext Math.php
php /usr/share/mediawiki/maintenance/update.php

Go create your math formulas...

Note: if you added the above to /etc/mediawiki/extensions.php you might have to clear mediawiki page cache.

More resources:

Migrating TurnKey Mediawiki from v14.1 to v14.2

TurnKey Mediawiki v14.2 saw a change in how the Mediawiki software itself is installed. Since the Debian package is no longer present in jessie, the appliance now uses the upstream installation archive.

The migration from Mediawiki installed from Debian packages to the upstream Mediawiki now installed in the TurnKey Mediawiki appliance should be fairly straightforward. The paths containing various parts of the Mediawiki platform have changed.

Old folderNew folder
/etc/mediawiki/var/www/mediawiki
/usr/share/mediawiki/var/www/mediawiki
/var/lib/mediawiki/var/www/mediawiki

 

 

 

 

As can be seen, the Mediawiki files are no longer scattered all over the filesystem but gathered in one place (the webroot, /var/www/mediawiki). While this is a bit of a hurdle, it allows one to use the upstream Mediawiki HOWTOs without adjusting them to the Debian paths. The process of migrating your old Mediawiki install to a new version should include moving over the file data, the database dump and the images.

Database

The database can be duplicated with the aid of mysqldump. The usual command looks like this:

# mysqldump -h localhost -u mediawiki -p mediawiki > backup.sql

Then upload the dump to the target machine using e. g. scp:

# scp backup.sql someuser@example.com:

Finally, load it to the target server's database:

# mysql < backup.sql

If your target machine is an already initialized instance of v14.2 TurnKey Mediawiki, it will have the needed user and database. The password however will be different; you can use the one in /var/www/mediawiki/LocalSettings.php on the target server.

Files

Mediawiki provides a script which makes obtaining "backups" of the file-based content easy.

# php /usr/share/mediawiki/maintenance/dumpBackup.php --current --report --output=bzip2:wikiexport.xml.bz2

Afterwards, copy the file to your new server using scp as already shown above. You can restore it with:

# bzip -d wikiexport.xml.bz2
# php /var/www/mediawiki/maintenance/importDump.php wikiexport.xml

Images

First, generate an archive of all images on the old server:

# tar cjf wikiimages.tar.bz2 /usr/share/mediawiki/images

Then, move it to the new location and import:

# tar xjf wikiimages.tar.bz2
# php /var/www/mediawiki/maintenance/importImages.php --overwrite --search-recursively images/

Finish

Finally, make sure that the permissions are set properly after you have performed the previous steps as root.

# chown -R www-data:www-data /var/www/mediawiki

If you are installing TurnKey Mediawiki v14.2 over an old installation, preparing a full backup (instead of just the Mediawiki data as detailed above) in advance of the migration is advised.

For additional pointers, please consult the Mediawiki manual on moving as well as backing up and restoring from a backup.