User:Lahwaacz/LocalArchWiki

From ArchWiki
Jump to: navigation, search

Following these steps will create a MediaWiki installation on localhost, with ArchWiki's skin and most of its content. Suitable for testing bots, preparing feature requests or bug reports, or just messing around.

The intention is to keep the configuration as close to ArchWiki as possible.

Clone the ArchWiki repo

First clone the repo with ArchWiki's installation:

$ git clone git://projects.archlinux.org/vhosts/wiki.archlinux.org.git

Install MediaWiki

Installing MediaWiki is described in MediaWiki, or upstream.

Install and configure needed packages:

  • mariadb (the real ArchWiki still runs on MySQL)
Create a database for LocalArchWiki as described upstream. See MariaDB for general instructions.
(optional) php-fpm is used on ArchWiki as the FastCGI server
(optional) php-apcu and php-apcu-bc for bytecode caching (uncomment both extensions in /etc/php/conf.d/apcu.ini)
See MediaWiki#PHP for necessary configuration.
  • Set up a web server. See MediaWiki#Web server for details. The server root is where you cloned the git repo.

To complete the installation, open the wiki url (http://localhost/mediawiki) in a browser and click yourself through the initial configuration. There are a few considerations:

  • Do not share a single database between multiple MediaWiki installations. When asked for "optional database table name prefix", do not specify anything. This would make using SQL scripts and importing database dumps much harder. See mw:Manual:$wgDBprefix for details.
  • Consider using different username than on ArchWiki for easier distinction between local and ArchWiki edits, for example ArchWiki username.local.

Finally download the generated LocalSettings.php and save it in the server root directory.

Configuration

Modify LocalSettings.php to include LocalSettings.localhost.php:

LocalSettings.php
...
# Add more configuration in the file included below.
include( "LocalSettings.archlinux.org.php" );
include( "LocalSettings.localhost.php" );

There are some settings in LocalSettings.archlinux.org.php that you might want to override for running on localhost:

LocalSettings.archlinux.org.php
<?php

# Protect against web entry
if ( !defined( 'MEDIAWIKI' ) ) {
	exit;
}

# overrides for running LocalArchWiki on localhost
# (settings not present in either LocalSettings.php or LocalSettings.archlinux.org)
$wgSitename = "LocalArchWiki";
$wgServer = "http://localhost";
$wgScriptPath = "/mediawiki";
$wgStylePath = "/mediawiki/skins";

$wgEnableEmail = false;

$wgCacheDirectory = false;
$wgEnableSidebarCache = false;
$wgUseFileCache = false;
$wgFileCacheDirectory = false;

$wgGroupPermissions['*']['createaccount'] = false;

# for debugging
#$wgDBerrorLog = '/var/log/mediawiki/dberror.log';
#$wgShowSQLErrors = true;
#$wgDebugDumpSql  = true;
#$wgShowDBErrorBacktrace = true;
#$wgDebugLogFile = "/var/log/mediawiki/debug-{$wgDBname}.log";

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

Interwiki map

Tango-view-refresh-red.pngThis article or section is out of date.Tango-view-refresh-red.png

Reason: Interwiki links are now managed through Special:Interwiki, extensions/ArchInterWiki.sql was deleted. It shouldn't be hard to generate a similar sql script by querying the current interwiki map in the production wiki. (Discuss in User talk:Lahwaacz/LocalArchWiki#)

During installation, the interwiki table is populated with the links from maintenance/interwiki.list file. To update the table on already installed wiki, use the extensions/ArchInterWiki.sql SQL script to import the Arch interwiki map:

$ mysql -u db_username -p db_name < extensions/ArchInterWiki.sql

For more information see the upstream documentation:

Cloning content from ArchWiki

Download a XML dump of ArchWiki's database so that there is some real data to work with. Dumps are available on Archive.org.

Alternatively, to work with a small amount of data, use Special:Export on ArchWiki to create a custom XML dump.

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: TODO: how to import large data. See also Help talk:I18n#Moving Japanese pages to new external wiki. (Discuss in User talk:Lahwaacz/LocalArchWiki#)

So far I can say that php importDump.php < dumpfile.xml is slooooow, but the most reliable tool I have tried.

Tip: The MySQL binary logs might become very large after the import (about 15GB), so limit the binlog size before importing or purge it afterwards.