Table of Contents

Mediawiki

The Wikimedia foundation Wiki.

Setup

MySQL
CREATE DATABASE mediawiki CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;
CREATE USER 'mediawiki'@'X.X.X.X' IDENTIFIED BY 'mediawiki';
GRANT ALL ON mediawiki.* TO 'mediawiki'@'X.X.X.X' WITH GRANT OPTION;
FLUSH PRIVILEGES;
NGINX

Adapt this site configuration for your needs and update LocalSetttings.php for URL rewriting.

$wgScriptPath = "/w";
$wgArticlePath = "/wiki/$1";
$wgUsePathInfo = true;

Install

PHP composer
apt install composer
composer -V
Composer version 2.5.5 2023-03-21 11:50:05
PHP8 APCu
apt install php-pear php-dev
pecl install APCu
echo "extension=apcu.so" >> /etc/php/8.2/mods-available/local.ini
ln -sf /etc/php/8.2/mods-available/local.ini /etc/php/8.2/fpm/conf.d/10-local.ini
Wiki
mkdir -p /var/www/htdocs/www.example.com
cd /var/www/htdocs/www.example.com
wget "https://releases.wikimedia.org/mediawiki/1.43/mediawiki-1.43.0.zip"
unzip mediawiki-1.43.0.zip
mv mediawiki-1.43.0 w
chown -R www-data:www-data w
Settings

Visit the wiki site and follow the installation procedure which will conclude with a download of the LocalSettings.php file.

NB It's recommended to choose English as the installation language.

Edit the settings file and upload to the server and installation is complete.

$wgGroupPermissions['*']['createaccount'] = false;
wfLoadExtension('Nuke');
Language

If you didn't choose English as the installation language you can change it after installation.

For example, during installation the site language may have been set to “en-gb” (or something else) and it's preferable to use the Mediawiki default language of “en”.

Add the following to LocalSettings.php

$wgLanguageCode = "en";

Now reset the language to “en”.

echo 'MediaWiki\MediaWikiServices::getInstance()->getMessageCache()->clear()' | php maintenance/run.php eval
php maintenance/run.php userOptions.php language --old en-gb --new en

To disable language selection (from “en”) in user preferences, add the following to LocalSettings.php

$wgHiddenPrefs[] = 'language';

Resources

wgLanguageCode

DeleteBatch

Pywikibot

Wikibase