Configuration Miki's Kiwi Wiki on Noekeon.org: Difference between revisions

From miki
Jump to navigation Jump to search
 
(27 intermediate revisions by 2 users not shown)
Line 10: Line 10:
** Support <tt>class="wikitable"</tt> (MediaWiki).
** Support <tt>class="wikitable"</tt> (MediaWiki).
** Support for [[Template:Hidden]]
** Support for [[Template:Hidden]]
** Custom style for [[Mediawiki#SyntaxHighlight GeSHi|GeSHi]]
* Updated [[MediaWiki:Common.js]]
* Updated [[MediaWiki:Common.js]]
** Support for [[Template:Hidden]]
** Support for [[Template:Hidden]]
** Support for [[Template:Hide]], [[Template:Hide all]],[[Template:Show all]], [[Template:Hide show all]], [[Template:Toggle]].
** Support for [[Template:Hide]], [[Template:Hide all]],[[Template:Show all]], [[Template:Hide show all]], [[Template:Toggle]].
* Updated [[MediaWiki:Geshi.css]]
** Default style for <code>&lt;div></code> and <code>&lt;pre></code> in GeSHi.
* Define user custom CSS for vector (see user preference):
<source lang=css>
/* Override the default font-size: 0.8em in default Vector CSS */
#bodyContent {
font-size: 1.0em;
}
/* Set the overall font size for body, overriding browser settings */
body {
font-size: 11pt;
}
</source>
* Added a few templates:
* Added a few templates:
** [[Template:Pl2]]
** [[Template:Pl2]]
Line 18: Line 33:
** [[Template:Hidden]] (see [[Wikipedia:Wikipedia:NavFrame]] and [[http://en.wikipedia.org/wiki/Template:Hidden]])
** [[Template:Hidden]] (see [[Wikipedia:Wikipedia:NavFrame]] and [[http://en.wikipedia.org/wiki/Template:Hidden]])
** [[Template:Hide]], [[Template:Hide all]], [[Template:Show all]], [[Template:Hide show all]], [[Template:Toggle]] (see [http://openwetware.org/wiki/OpenWetWare:Toggle])
** [[Template:Hide]], [[Template:Hide all]], [[Template:Show all]], [[Template:Hide show all]], [[Template:Toggle]] (see [http://openwetware.org/wiki/OpenWetWare:Toggle])
* Updated [[MediaWiki:Sidebar]]
* Update user CSS: [[User:Mip/common.css]]


== Host-Side Configuration ==
== Host-Side Configuration ==
Line 60: Line 77:
** Enable '''file upload'''.
** Enable '''file upload'''.
** Set logo (from http://sneak.co.nz/kiwi/ - resized to 135x135 max)
** Set logo (from http://sneak.co.nz/kiwi/ - resized to 135x135 max)
{{pl2|<source lang="php">
<source lang="php">
$wgEnableUploads = true;
$wgEnableUploads = true;
...
...
$wgLogo = "$wgScriptPath/kiwi.png";
$wgLogo = "$wgScriptPath/kiwi.png";
</source>}}
</source>
* File '''<tt>includes/DefaultSettings.php</tt>''':
* File '''<tt>includes/DefaultSettings.php</tt>''':
** Change supported upload file types (added 'pdf' and 'zip').
** Change supported upload file types (added 'pdf' and 'zip').
** Restrict anonymous editing (edit requires user to login)
** Restrict anonymous editing (edit requires user to login)
{{pl2|<source lang="php">
<source lang="php">
$wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg', 'pdf', 'zip' );
$wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg', 'pdf', 'zip' );
...
...
$wgGroupPermissions['*' ]['edit'] = false;
$wgGroupPermissions['*' ]['edit'] = false;
</source>}}
</source>
* Add directory '''<tt>https://kiwi.noekeon.org/miki/upload</tt>''', to store big upload files.
* Add directory '''<tt>https://kiwi.noekeon.org/miki/upload</tt>''', to store big upload files.
** Create a fake <tt>index.html</tt> simulating listing of an empty upload directory.
** Create a fake <tt>index.html</tt> simulating listing of an empty upload directory.
Line 80: Line 97:
:: email: '''miki.mip@noekeon.org'''
:: email: '''miki.mip@noekeon.org'''
:: real name: '''Mike'''
:: real name: '''Mike'''
* Setup '''favicon.ico''' (this [[Media:Favicon kiwi-32x32.png|file]]), but saved as <tt>/favicon.icon</tt> (because otherwise Opera does not display it, go figure why).<br/>Edit file <tt>./includes/DefaultSettings.php</tt>:
<source lang="php">
$wgFavicon = '/favicon.icon';
</source>
* Enable user CSS:
<source lang=php>
$wgAllowUserCss = true;
</source>
* Add user '''[[User:Mip]]''' to group [[Miki:Bureaucrats]] and [[Miki:Administrators]].
* Enable some more permissions ([https://www.mediawiki.org/wiki/Manual:RevisionDelete revision deletion]). Add to {{file|LocalSettings.php}}:
<source lang=php>
# Enable some extra permissions (https://www.mediawiki.org/wiki/Manual:RevisionDelete)
$wgGroupPermissions['sysop']['deletelogentry'] = true;
$wgGroupPermissions['sysop']['deleterevision'] = true;
$wgGroupPermissions['oversight']['hideuser'] = true;
$wgGroupPermissions['oversight']['suppressrevision'] = true;
$wgGroupPermissions['oversight']['suppressionlog'] = true;
$wgGroupPermissions['observer']['viewsuppressed'] = true;
</source>


== Extensions ==
== Extensions ==
Here the list of extensions installed on the Wiki:
Here the list of extensions installed on the Wiki:

* Extension [[Mediawiki#SyntaxHighlight_GeSHi|SyntaxHighlight_GeSHi]].
;[[Mediawiki#SyntaxHighlight_GeSHi|SyntaxHighlight_GeSHi]].
** Version ''r24298 (July 21, 2007)'' / GeSHi version ''1.0.8''.
* (2007-07-21) Version r24298 / GeSHi version 1.0.8.
** [[Mediawiki#SyntaxHighlight_GeSHi|Patched]] to restore old GeSHi 1.0.7 formatting and to support <tt>enclose="valid"</tt>.
* (2010-01-06) Version r60735 / GeSHi version 1.0.8.6.
* (2009-09-05) Extension [http://wiki.yobi.be/wiki/Mediawiki_RawFile RawFile]
* <s>[[Mediawiki#SyntaxHighlight_GeSHi|Patched]] to restore old GeSHi 1.0.7 formatting and to support <tt>enclose="valid"</tt>.</s> Using a custome style in [[MediaWiki:Common.css]].
* (2013-01-15) Use version bundled in MV 1.22.1

; [http://www.mediawiki.org/wiki/Extension:Cite/Cite.php Cite]
* (2011-06-28) Version [http://upload.wikimedia.org/ext-dist/Cite-MW1.15-r48711.tar.gz r48711 for MediaWiki 15.x]
* (2013-01-15) Use version bundled in MW 1.22.1

;[http://wiki.yobi.be/wiki/Mediawiki_RawFile RawFile]
* (2009-09-05) Version 0.2
** [[Mediawiki#RawFile|Patched]] to add optional param to <nowiki>{{#filelink}}</nowiki>.
** [[Mediawiki#RawFile|Patched]] to add optional param to <nowiki>{{#filelink}}</nowiki>.
** [[Mediawiki#RawFile|Patched]] to allows using html attribute '''class''' instead of <code><nowiki>{{#fileanchor}}</nowiki></code>
**
* (2013-01-15) Version 0.4.1
* (2013-01-15) '''DISABLED''' &mdash; conflict with MW 1.22.1.

; [http://www.mediawiki.org/wiki/Extension:MathJax MathJax]
* Keep default configuration
<source lang=python>
# Extension:MathJax
require_once "$IP/extensions/MathJax/MathJax.php";
# $wgParserCacheType = CACHE_NONE; // See http://www.mediawiki.org/wiki/Extension:MathJax
</source>



Here the list of extensions that are no longer installed on the Wiki:

; [http://www.mediawiki.org/wiki/Extension:JsMath JsMath].
* ''DEPRECATED'' &mdash; no longer used, replaced by Extension:Math / MathJax (better rendering, more powerful, easier to install, and jsMath is no longer updated).

; [http://www.mediawiki.org/wiki/Extension:Math Math]
* ''DEPRECATED'' &mdash; We don't use this extension anymore, but use MathJax extension instead (which allows for <code>$...$</code> formulas).
* Configure ''Math'' to use ''MathJax'' javascript engine for much better results.
<source lang=python>
require_once "$IP/extensions/Math/Math.php";
// Set this if you don't use MediaWiki Math's texvc:
# $wgTexvc = '/your/path/to/texvc';

$wgUseMathJax = true; // enabeling MathJax as rendering option
$wgDefaultUserOptions['math'] = MW_MATH_MATHJAX; // setting MathJax as default rendering option (optional)
/**
* The default parser for MathJax is 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML'
* If you don't want to or can't use the default and your run your own locally
* replace the below url with something like:
* $wgMathJaxUrl = '/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML';
*/
$wgMathJaxUrl = 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML';
MathJax_Parser::$do_dollar = false;
</source>


== Installation ==
== Installation ==
Line 95: Line 177:
* and go to [http://mail.priorweb.be/ Priorweb mailmanager] to create email address (see <tt>$wgEmergencyContact</tt>)
* and go to [http://mail.priorweb.be/ Priorweb mailmanager] to create email address (see <tt>$wgEmergencyContact</tt>)
* then ssh to <tt>daemenj@ftp.noekeon.org</tt>:
* then ssh to <tt>daemenj@ftp.noekeon.org</tt>:
{{pl2|<source lang="bash">
<source lang="bash">
cd kiwi.noekeon.org/
cd kiwi.noekeon.org/
wget http://download.wikimedia.org/mediawiki/1.13/mediawiki-1.13.0.tar.gz
wget http://download.wikimedia.org/mediawiki/1.13/mediawiki-1.13.0.tar.gz
Line 102: Line 184:
cd miki
cd miki
chmod +w config
chmod +w config
</source>}}
</source>
* Browse to '''https://kiwi.noekeon.org/miki/config/'''. Enter settings as given further.
* Browse to '''https://kiwi.noekeon.org/miki/config/'''. Enter settings as given further.
* Move configuration file:
* Move configuration file:
{{pl2|<source lang="bash">
<source lang="bash">
mv config/LocalSettings.php .
mv config/LocalSettings.php .
chmod 600 LocalSettings.php
chmod 600 LocalSettings.php
rm -r config
rm -r config
</source>}}
</source>
* It's done!
* It's done!


== Upgrade ==
== Upgrade ==
* Version '''mediawiki 1.15.1'''
=== Version 1.15.1 ===
* Update procedure explained in <tt>UPGRADE</tt>:
* Update procedure explained in <tt>UPGRADE</tt>:
{{pl2|<source lang="bash">
<source lang="bash">
mv miki miki-old
mv miki miki-old
tar -xvzf mediawiki-1.15.1.tar.gz
tar -xvzf mediawiki-1.15.1.tar.gz
Line 130: Line 212:
rm -r ../miki-old
rm -r ../miki-old
# Don't forget to remove miki-old when everything's fine
# Don't forget to remove miki-old when everything's fine
</source> }}
</source>

=== Version 1.22.1 ===
* Not really an upgrade, but reinstall. Upgrade caused issue with the new short-URL, and our ''LocalSettings.php'' was too old.
<source lang=bash>
mv miki oldmiki
wget http://download.wikimedia.org/mediawiki/1.22/mediawiki-1.22.1.tar.gz
tar -xvzf mediawiki-1.22.1.tar.gz
mv mediawiki-1.22.1 miki
cp -iar oldmiki/images miki
cp -iar oldmiki/upload miki
cp oldmiki/kiwi.png miki
</source>
* Go to https://kiwi.noekeon.org/miki/index.php, and follow instructions, and install given ''LocalSettings.php''.
** Enable extension ''Cite'', ''WikiEditor'' and ''SyntaxHighlight''.
* Install other extensions

=== Version 1.28.1 ===
First tentative, install from {{file|.tar.gz}} file. Aborted because of two reasons:
* Tried to install the new ''mathoid'' extension.
* Extension GeSHi was not working.

;Mathoid
* Reference:
:* [https://github.com/wikimedia/mathoid Mathoid github]
:* [https://www.mediawiki.org/wiki/Mathoid Mathoid mediawiki]
:* [https://nodejs.org/en/download/package-manager/ Installing node.js]
<source lang=bash>
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
</source>
:* [https://docs.npmjs.com/getting-started/installing-node Installing npm]
:* [http://stackoverflow.com/questions/9023672/how-do-i-resolve-cannot-find-module-error-using-node-js About node modules not found]
* None of the install procedure works on Debian Jessie. This is what I did:
<source lang=bash>
# Make sure umask is correct *** IMPORTANT ***
umask 022

# Install newest node.js -- the one of Jessie is much too old for Mathoid
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
apt install -y nodejs
# Install some dependencies
apt install librsvg2-dev
# Install npm *GLOBALLY*, as root, YES AS ROOT, GOSH
# ... Installing as root was the only way to solve the problem of "./app.js" module not found
npm install -g mathoid
# ... mathoid is installed in /usr/lib/node_modules/mathoid
# ... test that it works:
cd /usr/lib/node_modules/mathoid
node server.js
# ... in a separate shell:
curl -d 'q=E=mc^2' localhost:10044

# Make sure umask is correct
umask 022

# We do a few things (from debian/mathoid.install / debian/mathoid.postinst)
addgroup --system mathoid
adduser --system --home /usr/lib/node_modules/mathoid --no-create-home --disabled-password --ingroup mathoid mathoid
cd /var/log
mkdir mathoid
chown mathoid:mathoid mathoid
chmod 700 mathoid

# If ok, generate the scripts
# We run the script to generate the startup scripts:
mkdir scripts/init
cd scripts/init
../gen-init-scripts.rb .

# Edit the files and copy as necessary

vi debian/mathoid.upstart
vi debian/mathoid.default
vi debian/mathoid.logrotate
vi config.dev.yaml
vi script/init/mathoid.service

cp debian/mathoid.upstart /etc/init/mathoid.conf
cp debian/mathoid.default /etc/default/mathoid
cp debian/mathoid.logrotate /etc/logrotate.d/mathoid
cp config.dev.yaml /etc/mathoid/config.yaml
cp script/init/mathoid.service /etc/systemd/system/mathoid.service

# Test everything is ok
systemctl start mathoid
systemctl status mathoid -l
ss -tupan|grep 10044
curl -d 'q=E=mc^2' localhost:10044
</source>

;GeSHi
* No rendering, no error, nothing, except category ''page with highlight problems''.
* Actually the issue was that <code>shell_exec</code> and <code>proc_open</code> (and maybe others) was disabled in PHP on server. See [https://phabricator.wikimedia.org/T128993 Phabricator bug T128993].
* To get debug output, add to {{file|LocalSettings.php}}:
<source lang=php>
$wgShowExceptionDetails = true;
$wgDevelopmentWarnings = true;
error_reporting( -1 );
ini_set( 'display_startup_errors', 1 );
ini_set( 'display_errors', 1 );

$wgDebugLogFile = "/var/lib/mediawiki/images/debug.log";
</source>
* To remove all interfering permissions, check files {{file|/etc/php5/apache2/php.ini}} and possibly files in {{file|/etc/php5/apache2/conf.d/}}, for lines like
<source lang=php>
disable_functions = shell_exec, escapeshellarg, escapeshellcmd, proc_close, proc_get_status, proc_nice, proc_open, proc_terminate</source>
and clear out everything (doing so MAY EXPOSE YOUR SERVER TO FOREIGN ATTACKS!):
<source lang=php>
disable_functions =
</source>

=== version 1.27.1 ===
Installed from debian package:
* First, import logo {{file|kiwi.png}} as an image, such that now file is in {{file|./images/e/ea/Kiwi.png}}.
* Install the package
<source lang=bash>
apt install mediawiki
vi /etc/apache2/conf-available/mediawiki.conf
# Remove Alias /mediawiki /var/lib/mediawiki
vi /etc/apache2/sites-available/www.immie.org.conf
# Add 'Alias /wiki /var/lib/mediawiki'
</source>
* Now visit the site and follow instruction. This upgrade the database and generate a new Localsettings.php
<source lang=bash>
cp LocalSettings.php /etc/LocalSettings.php
chown www-data:www-data /etc/LocalSettings.php
chmod 700 /etc/LocalSettings.php
rm LocalSettings.php
cd /var/www
cp -rp --no-clobber /wiki/images /var/lib/mediawiki
mv wiki mediawiki
</source>
* Add MathJax.
<source lang=bash>
cd /var/lib/mediawiki/extensions
git clone https://github.com/hbshim/mediawiki-mathjax MathJax
chown -R www-data:www-data MathJax
cd /usr/share/javascript/mathjax/config/local
ln -sf /var/lib/mediawiki/extensions/MathJax/mwMathJaxConfig.js
vi mwMathJaxConfig.js
# Edit URL at the end of the file
vi /etc/mediawiki/LocalSettings.php
# Add Mathjax stuff:
#
# # Extension:MathJax
# wfLoadExtension( 'MathJax' );
# # MathJax location
# $wgMathJaxJS = "/mathjax/MathJax.js";
# # Configuration - see "http://docs.mathjax.org/en/latest/config-files.html"
# $wgMathJaxProcConf = "TeX-AMS-MML_HTMLorMML-full";
# # Local configuration file (excluding .js)
# $wgMathJaxLocConf = "local/mwMathJaxConfig";
# $wgParserCacheType = CACHE_NONE;
</source>

;Troubleshooting
* See above for GeSHi not running.

== Troubleshooting ==
See [https://www.mediawiki.org/wiki/Manual:How_to_debug MediaWiki - how to debug].

Mainly add to {{file|LocalSettings.php}}:
<source lang=php>
$wgShowExceptionDetails = true;
$wgDevelopmentWarnings = true;
error_reporting( -1 );
ini_set( 'display_startup_errors', 1 );
ini_set( 'display_errors', 1 );

$wgDebugLogFile = "/var/lib/mediawiki/images/debug.log";
</source>


== Backup ==
== Backup ==
Line 140: Line 393:
My procedure:
My procedure:
* Copy this file to the wiki server, and make it executable.
* Copy this file to the wiki server, and make it executable.
{{pl2|
{{pl2|1=
{{hidden|<tt>backup_wiki</tt>
{{hidden|1=<tt>backup_wiki</tt>
([{{#filelink: backup_wiki}} download])|{{#fileanchor: backup_wiki}}
([{{#filelink: backup_wiki}} download])|2={{#fileanchor: backup_wiki}}<source lang="bash">
<source lang="bash">
#! /bin/bash
#! /bin/bash


Line 189: Line 441:


* Run this script on the machine where the backup files are to be saved (adapt the script to your needs):
* Run this script on the machine where the backup files are to be saved (adapt the script to your needs):
{{pl2|
{{pl2|1=
{{hidden|<tt>~/bin/backup_noekeon</tt>
{{hidden|1=<tt>~/bin/backup_noekeon</tt>
([{{#filelink: backup_noekeon}} download])|{{#fileanchor: backup_noekeon}}
([{{#filelink: backup_noekeon}} download])|2={{#fileanchor: backup_noekeon}}
<source lang="bash">
<source lang="bash">
#! /bin/bash
#! /bin/bash
Line 209: Line 461:


echo "Backing up the files & extensions to '$FFILENAME'..."
echo "Backing up the files & extensions to '$FFILENAME'..."
ssh noekeon 'cd ~daemenj/kiwi.noekeon.org; tar -cz miki/' > "$FFILENAME"
ssh noekeon 'cd ~daemenj/kiwi.noekeon.org; /usr/bin/nice -n 19 tar -cz miki/' > "$FFILENAME"
</source>|headerstyle=background:#ccccff;text-align:left;}} }}
</source>|headerstyle=background:#ccccff;text-align:left;}} }}

To restore a MediaWiki backup on a local LAMP server (see also [http://wiki.tardis.ed.ac.uk/index.php/MediaWiki_Installation] for DB creation, and [http://www.devshed.com/c/a/MySQL/Backing-up-and-restoring-your-MySQL-Database/] for MySQL restore command):
<source lang="bash">
MYSQL_HISTFILE=/dev/null mysql --user=root -p mysql
</source>

<source lang="mysql">
mysql> CREATE DATABASE mikiwiki;
mysql> GRANT ALL PRIVILEGES ON mikiwiki.* TO miki@localhost IDENTIFIED BY '********';
mysql> quit
</source>

<source lang="bash">
#Restore the wiki files
sudo mkdir /var/www/miki
cd /var/www/miki
sudo tar --strip 1 -xvzf ~/backup/wiki-20091111-www.noekeon.org_miki.daily.tar.gz
sudo chown -R www-data /var/www/miki
sudo chgrp -R www-data /var/www/miki
#Edit /var/www/miki/LocalSettings.php to match current config
sudo vi /var/www/miki/LocalSettings.php
# ... $wgDBserver="localhost"

# Restore the SQL backup (! note that mikiwiki is not the password, but the db name !!!):
gunzip < wiki-20091111-www.noekeon.org_miki.daily.sql.gz | mysql -u miki -p mikiwiki
# ... enter password for user miki
</source>

== To Do ==
* '''DONE''' &mdash; Upgrade jsMath to [http://www.mathjax.org/ MathJax] (see also [http://www.mediawiki.org/wiki/Extension:Math#MathJax]) (this requires MediaWiki 1.19 or higher)

Latest revision as of 10:19, 1 December 2016

Reference

Consult the User's Guide for information on using the wiki software.

Wiki Configuration

/* Override the default font-size: 0.8em in default Vector CSS */
#bodyContent {
    font-size: 1.0em;
}
 
/* Set the overall font size for body, overriding browser settings */
body {
    font-size: 11pt;
}

Host-Side Configuration

  • Wiki configuration settings during install:
Field Value Field Value
Wiki name miki email address auth enabled
contact e-mail ($wgEmergencyContact) miki@noekeon.org ($wgDBtype) database type MySQL
Language en - English ($wgDBserver) database host mysqlhost (as said on Priorweb's controlpanel)
Copyright no license ($wgDBname) database name mikiwiki
Admin username mikiadmin ($wgDBuser) DB username miki
Admin pwd ******** ($wgDBpassword) DB password ********
Object caching no caching su account <unchecked>
Email features enabled DB table prefix <none>
user-to-user email enabled Storage engine InnoDB
email notification enabled (discussion & watchlist) database character set MySQL 4.1/5.0 binary
$wgEnableUploads = true;
...
$wgLogo = "$wgScriptPath/kiwi.png";
  • File includes/DefaultSettings.php:
    • Change supported upload file types (added 'pdf' and 'zip').
    • Restrict anonymous editing (edit requires user to login)
$wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg', 'pdf', 'zip' );
...
$wgGroupPermissions['*'    ]['edit']             = false;
user: mip
pwd: ********
email: miki.mip@noekeon.org
real name: Mike
  • Setup favicon.ico (this file), but saved as /favicon.icon (because otherwise Opera does not display it, go figure why).
    Edit file ./includes/DefaultSettings.php:
$wgFavicon                       = '/favicon.icon';
  • Enable user CSS:
$wgAllowUserCss = true;
# Enable some extra permissions (https://www.mediawiki.org/wiki/Manual:RevisionDelete)
$wgGroupPermissions['sysop']['deletelogentry'] = true;
$wgGroupPermissions['sysop']['deleterevision'] = true;
$wgGroupPermissions['oversight']['hideuser'] = true;
$wgGroupPermissions['oversight']['suppressrevision'] = true;
$wgGroupPermissions['oversight']['suppressionlog'] = true;
$wgGroupPermissions['observer']['viewsuppressed'] = true;

Extensions

Here the list of extensions installed on the Wiki:

SyntaxHighlight_GeSHi.
  • (2007-07-21) Version r24298 / GeSHi version 1.0.8.
  • (2010-01-06) Version r60735 / GeSHi version 1.0.8.6.
  • Patched to restore old GeSHi 1.0.7 formatting and to support enclose="valid". Using a custome style in MediaWiki:Common.css.
  • (2013-01-15) Use version bundled in MV 1.22.1
Cite
RawFile
  • (2009-09-05) Version 0.2
    • Patched to add optional param to {{#filelink}}.
    • Patched to allows using html attribute class instead of {{#fileanchor}}
  • (2013-01-15) Version 0.4.1
  • (2013-01-15) DISABLED — conflict with MW 1.22.1.
MathJax
  • Keep default configuration
# Extension:MathJax
require_once "$IP/extensions/MathJax/MathJax.php";
# $wgParserCacheType = CACHE_NONE;  // See http://www.mediawiki.org/wiki/Extension:MathJax


Here the list of extensions that are no longer installed on the Wiki:

JsMath.
  • DEPRECATED — no longer used, replaced by Extension:Math / MathJax (better rendering, more powerful, easier to install, and jsMath is no longer updated).
Math
  • DEPRECATED — We don't use this extension anymore, but use MathJax extension instead (which allows for $...$ formulas).
  • Configure Math to use MathJax javascript engine for much better results.
require_once "$IP/extensions/Math/Math.php";
// Set this if you don't use MediaWiki Math's texvc:
# $wgTexvc =  '/your/path/to/texvc';

$wgUseMathJax = true; // enabeling MathJax as rendering option
$wgDefaultUserOptions['math'] = MW_MATH_MATHJAX; // setting MathJax as default rendering option (optional)
/**
 * The default parser for MathJax is 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML'
 * If you don't want to or can't use the default and your run your own locally
 * replace the below url with something like:
 * $wgMathJaxUrl = '/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML';
 */
$wgMathJaxUrl = 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML';
MathJax_Parser::$do_dollar = false;

Installation

  • Version mediawiki 1.13.0.
  • First go to Priorweb control panel, MySQL section, and creates new user (see $wgDBname, $wgDBuser and $wgDBpassword above)
  • and go to Priorweb mailmanager to create email address (see $wgEmergencyContact)
  • then ssh to daemenj@ftp.noekeon.org:
cd kiwi.noekeon.org/
wget http://download.wikimedia.org/mediawiki/1.13/mediawiki-1.13.0.tar.gz
tar -xvzf mediawiki-1.13.0.tar.gz
mv mediawiki-1.13.0 miki
cd miki
chmod +w config
mv config/LocalSettings.php .
chmod 600 LocalSettings.php
rm -r config
  • It's done!

Upgrade

Version 1.15.1

  • Update procedure explained in UPGRADE:
mv miki miki-old
tar -xvzf mediawiki-1.15.1.tar.gz
mv mediawiki-1.15.1 miki
cp miki-old/LocalSettings.php miki
cp -r miki-old/images miki
cp -r miki-old/extensions miki
rm -r miki/config
cd miki
cp AdminSettings.sample AdminSettings.php
vi AdminSettings.php                          # Edit the file as necessary
cd maintenance
php update.php
rm -r ../miki-old
# Don't forget to remove miki-old when everything's fine

Version 1.22.1

  • Not really an upgrade, but reinstall. Upgrade caused issue with the new short-URL, and our LocalSettings.php was too old.
mv miki oldmiki 
wget http://download.wikimedia.org/mediawiki/1.22/mediawiki-1.22.1.tar.gz 
tar -xvzf mediawiki-1.22.1.tar.gz
mv mediawiki-1.22.1 miki
cp -iar oldmiki/images miki
cp -iar oldmiki/upload miki
cp oldmiki/kiwi.png miki

Version 1.28.1

First tentative, install from .tar.gz file. Aborted because of two reasons:

  • Tried to install the new mathoid extension.
  • Extension GeSHi was not working.
Mathoid
  • Reference:
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
  • None of the install procedure works on Debian Jessie. This is what I did:
# Make sure umask is correct *** IMPORTANT ***
umask 022

# Install newest node.js -- the one of Jessie is much too old for Mathoid
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
apt install -y nodejs
# Install some dependencies
apt install librsvg2-dev
# Install npm *GLOBALLY*, as root, YES AS ROOT, GOSH
# ... Installing as root was the only way to solve the problem of "./app.js" module not found 
npm install -g mathoid
# ... mathoid is installed in /usr/lib/node_modules/mathoid
# ... test that it works:
cd /usr/lib/node_modules/mathoid
node server.js
# ... in a separate shell:
curl -d 'q=E=mc^2' localhost:10044

# Make sure umask is correct
umask 022

# We do a few things (from debian/mathoid.install / debian/mathoid.postinst)
addgroup --system mathoid
adduser --system --home /usr/lib/node_modules/mathoid --no-create-home --disabled-password --ingroup mathoid mathoid
cd /var/log
mkdir mathoid
chown mathoid:mathoid mathoid
chmod 700 mathoid

# If ok, generate the scripts
# We run the script to generate the startup scripts:
mkdir scripts/init
cd scripts/init
../gen-init-scripts.rb .

# Edit the files and copy as necessary

vi debian/mathoid.upstart
vi debian/mathoid.default
vi debian/mathoid.logrotate
vi config.dev.yaml
vi script/init/mathoid.service

cp debian/mathoid.upstart /etc/init/mathoid.conf
cp debian/mathoid.default /etc/default/mathoid
cp debian/mathoid.logrotate /etc/logrotate.d/mathoid
cp config.dev.yaml /etc/mathoid/config.yaml
cp script/init/mathoid.service /etc/systemd/system/mathoid.service

# Test everything is ok
systemctl start mathoid
systemctl status mathoid -l
ss -tupan|grep 10044
curl -d 'q=E=mc^2' localhost:10044
GeSHi
  • No rendering, no error, nothing, except category page with highlight problems.
  • Actually the issue was that shell_exec and proc_open (and maybe others) was disabled in PHP on server. See Phabricator bug T128993.
  • To get debug output, add to LocalSettings.php:
$wgShowExceptionDetails = true;
$wgDevelopmentWarnings = true;
error_reporting( -1 );
ini_set( 'display_startup_errors', 1 );
ini_set( 'display_errors', 1 );

$wgDebugLogFile = "/var/lib/mediawiki/images/debug.log";
  • To remove all interfering permissions, check files /etc/php5/apache2/php.ini and possibly files in /etc/php5/apache2/conf.d/, for lines like
disable_functions = shell_exec, escapeshellarg, escapeshellcmd, proc_close, proc_get_status, proc_nice, proc_open, proc_terminate

and clear out everything (doing so MAY EXPOSE YOUR SERVER TO FOREIGN ATTACKS!):

disable_functions =

version 1.27.1

Installed from debian package:

  • First, import logo kiwi.png as an image, such that now file is in ./images/e/ea/Kiwi.png.
  • Install the package
apt install mediawiki
vi /etc/apache2/conf-available/mediawiki.conf
# Remove Alias /mediawiki /var/lib/mediawiki
vi /etc/apache2/sites-available/www.immie.org.conf
# Add 'Alias /wiki /var/lib/mediawiki'
  • Now visit the site and follow instruction. This upgrade the database and generate a new Localsettings.php
cp LocalSettings.php /etc/LocalSettings.php
chown www-data:www-data /etc/LocalSettings.php
chmod 700 /etc/LocalSettings.php
rm LocalSettings.php
cd /var/www
cp -rp --no-clobber /wiki/images /var/lib/mediawiki
mv wiki mediawiki
  • Add MathJax.
cd /var/lib/mediawiki/extensions
git clone https://github.com/hbshim/mediawiki-mathjax MathJax
chown -R www-data:www-data MathJax
cd /usr/share/javascript/mathjax/config/local
ln -sf /var/lib/mediawiki/extensions/MathJax/mwMathJaxConfig.js
vi mwMathJaxConfig.js
# Edit URL at the end of the file
vi /etc/mediawiki/LocalSettings.php
# Add Mathjax stuff:
#
# # Extension:MathJax
# wfLoadExtension( 'MathJax' );
# # MathJax location
# $wgMathJaxJS = "/mathjax/MathJax.js";
# # Configuration - see "http://docs.mathjax.org/en/latest/config-files.html"
# $wgMathJaxProcConf = "TeX-AMS-MML_HTMLorMML-full";
# # Local configuration file (excluding .js)
# $wgMathJaxLocConf = "local/mwMathJaxConfig";
# $wgParserCacheType = CACHE_NONE;
Troubleshooting
  • See above for GeSHi not running.

Troubleshooting

See MediaWiki - how to debug.

Mainly add to LocalSettings.php:

$wgShowExceptionDetails = true;
$wgDevelopmentWarnings = true;
error_reporting( -1 );
ini_set( 'display_startup_errors', 1 );
ini_set( 'display_errors', 1 );

$wgDebugLogFile = "/var/lib/mediawiki/images/debug.log";

Backup

Some references:

My procedure:

  • Copy this file to the wiki server, and make it executable.
  • Run this script on the machine where the backup files are to be saved (adapt the script to your needs):

To restore a MediaWiki backup on a local LAMP server (see also [3] for DB creation, and [4] for MySQL restore command):

MYSQL_HISTFILE=/dev/null  mysql --user=root -p mysql
mysql> CREATE DATABASE mikiwiki;
mysql> GRANT ALL PRIVILEGES ON mikiwiki.* TO miki@localhost IDENTIFIED BY '********';
mysql> quit
#Restore the wiki files
sudo mkdir /var/www/miki
cd /var/www/miki
sudo tar --strip 1 -xvzf ~/backup/wiki-20091111-www.noekeon.org_miki.daily.tar.gz
sudo chown -R www-data /var/www/miki
sudo chgrp -R www-data /var/www/miki
#Edit /var/www/miki/LocalSettings.php to match current config
sudo vi /var/www/miki/LocalSettings.php
# ... $wgDBserver="localhost"

# Restore the SQL backup (! note that mikiwiki is not the password, but the db name !!!):
gunzip < wiki-20091111-www.noekeon.org_miki.daily.sql.gz | mysql -u miki -p mikiwiki
# ... enter password for user miki

To Do

  • DONE — Upgrade jsMath to MathJax (see also [5]) (this requires MediaWiki 1.19 or higher)