User:Lahwaacz/LocalArchWiki
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 https://github.com/archlinux/archwiki.git
Install MediaWiki
Installing MediaWiki is described in MediaWiki, or upstream.
Install and configure needed packages:
- mariadb (the real ArchWiki still runs on MySQL)
- (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
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.
- https://www.mediawiki.org/wiki/Manual:Importing_XML_dumps
- https://meta.wikimedia.org/wiki/Data_dumps/Tools_for_importing
- https://github.com/nutztherookie/mwdum.py
- https://www.flynsarmy.com/2011/10/split-large-mysql-dump-files/
So far I can say that php importDump.php < dumpfile.xml
is slooooow, but the most reliable tool I have tried.