Intranet/Intranet Installation

WORK IN PROGRESS

This page documents installing Mediawiki from git, some basic customisation and an upgrade process. This process builds upon the reference OS and supporting software detailed at ##### link here ####

By maintaining the link to the code via a symlink and using more to ensure that we don't lose images and settings by accident, we can switch versions quickly. A simple database backup scheme is also included here and a full process to help ensure smooth, safe upgrades.

Filesystem layout
By following this procedure, the directory structure you end up with is like this:

Pre requisites

 * Install PHP modules
 * Install git
 * Imagemagick (for image thumbnails) See https://www.mediawiki.org/wiki/Manual:Installing_third-party_tools
 * Setup database

Mediawiki
Check what version Wikipedia is using with https://en.wikipedia.org/wiki/Special:Version You might also want to check here: https://phabricator.wikimedia.org/source/mediawiki/branches/

Find a version using git ls-remote: Clone the chosen version Update the submodules and Composer managed libraries

Web based Installer
This is just the initial install. We will change the URL to access MW later. Browse to https://wiki.example.co.uk/mediawiki Keep the settings to a minimum and don't enable any modules. All of this can be changed later. At the end, download the provided LocalSettings.php file and upload it to the web server's filesystem at /var/www/html. Finally symlink to it from the wiki folder. cd /var/www/html/mediawiki ln -s /var/www/html/LocalSettings.php Disable the MinervaNeue skin in LocalSettings.conf to get the wiki to load until it is no longer dependent on MobileFrontend - see: https://www.mediawiki.org/wiki/Skin:Minerva_Neue. Edit LocalSettings.php and towards the end put a # in front of wfLoadSkin( 'MinervaNeue' );  #### REVIEW

Short URLs
Add a couple of Aliases to the virtual host definition. These are for the final desired short URLs: Change $wgScriptPath and add $wgArticlePath in LocalSettings.php to match the short URL: Browse to https://wiki.example.co.uk and check https://wiki.example.co.uk/wiki/Special:Version to make sure it all looks OK.

Logo
Copy a logo file into /var/www/html and rename it to logo.gif (or.png or whatever) and reference it in LocalSettings.php

Cache
This enables a simple filesystem based cache which will help speed up page load times. Create a cache directory for the wiki to use: Add this to LocalSettings.php:

Cronjob for update.php
Add the following to LocalSettings.php to disable runjobs (see https://www.mediawiki.org/wiki/Manual:Job_queue ) Add this to crontab (change the timings to suit - this example runs every seven minutes) Create a directory for the log When you are happy that runJobs is working correctly then either use something like logrotate to handle the ever growing log file or disable it by removing the redirection in crontab.

Enable wikieditor
Edit LocalSettings.php and add this at the bottom: Try editing a page. if the editor does not appear then hold down shift and press the reload button in your browser to clear the cached page.

Auth_remoteuser
The reference build that this article is part of sets REMOTE_USER via Kerberos.

Create local-extensions area. This avoids our locally maintained extensions from being overwritten by upgrades Get the latest code Configure the extension You should now be logged into an automatically created wiki account based on your AD username when you access the wiki.

Database Backups
This script is really designed for ad hoc use because you will be backing up the entire system anyway Create backup script in /usr/local/bin/mediawiki-backup.sh Make the script executable Run it and verify that you have a database backup file. There should be a file named wiki- .sql - check its contents to verify that it really is a backup

Updating
WORK IN PROGRESS

It is possible to avoid the downtime associated with snapshots and waiting for the code to download but this process is designed to be as safe as possible.

Before updating

 * Notify users
 * Check backups
 * Run database backup script
 * Shutdown the system and take a snapshot
 * Start the system
 * Stop the web server (systemctl stop apache2)

Update the code

 * Find a version using git ls-remote and check it out with git clone
 * Update the sub-modules
 * Remove the downloaded images directory that simply contains a README file and recreate symlinks

Switch to the new code

 * Make the wiki readonly. Put this at the bottom of LocalSettings.php:
 * Start Apache
 * Remove and re-point the symlink.
 * Run update.php
 * Make the wiki read/write. Delete or comment out $wgReadOnly
 * Run the database backup script again
 * Test the new code
 * Notify users that the wiki is available again