Wikibase/Installation

Other languages:
This document covers installing the Wikibase extension for MediaWiki. For manual installation instructions for the Wikibase suite, see Wikibase/Suite. For Docker installation instructions, see Wikibase/Docker.

This page provides step-by-step instructions for installing a basic, minimal version of Wikibase. If you're interested in more advanced configurations, please refer to the advanced configuration guide. More detailed documentation bound to each version of the code can be found in the docs folder of the Wikibase source repository: see doc.wikimedia.org.

PrerequisitesEdit

MediaWikiEdit

Since Wikibase is an extension (actually two extensions) to MediaWiki, you'll first need to set up MediaWiki.

  Warning: Wikibase does not maintain compatibility with older versions of MediaWiki! Recent versions of Wikibase will most likely not work with older versions of MediaWiki (and vice versa). Use the most recent versions of MediaWiki and Wikibase (master branches), or download the Wikibase release that matches your version of MediaWiki.

ComposerEdit

The easiest way to install all dependencies for Wikibase is to use Composer. Install Composer using these instructions.

InstallationEdit

A basic installation of Wikibase consists of four steps:

  1. Obtain Wikibase
  2. Install dependencies
  3. Modify LocalSettings.php
  4. Run maintenance scripts

The following guide will lead you through these steps.

Before you beginEdit

Make sure you've set up MediaWiki and installed Composer.

 
Fresh MediaWiki

Obtain WikibaseEdit

Determine which version of Mediawiki you have by navigating to wiki/Special:Version; use the Wikibase release corresponding to your MediaWiki version.

If you have the latest version of Mediawiki, download the latest version of Wikibase (or the version matching your Mediawiki installation) into the extensions folder of your MediaWiki installation.

Install dependenciesEdit

Thanks to the composer-merge-plugin, you can simply rename the composer.local.json-sample file in the root of your MediaWiki install directory to composer.local.json.

Then, from the root of your MediaWiki installation, run:

rm composer.lock

Then, assuming composer is available as a binary:

composer install --no-dev

Modify LocalSettings.phpEdit

Versions 1.36 and above use extension registration:

wfLoadExtension( 'WikibaseRepository', "$IP/extensions/Wikibase/extension-repo.json" );
require_once "$IP/extensions/Wikibase/repo/ExampleSettings.php";
wfLoadExtension( 'WikibaseClient', "$IP/extensions/Wikibase/extension-client.json" );
require_once "$IP/extensions/Wikibase/client/ExampleSettings.php";

Use the snippet below only if using versions below 1.36:

$wgEnableWikibaseRepo = true;
$wgEnableWikibaseClient = true;
require_once "$IP/extensions/Wikibase/repo/Wikibase.php";
require_once "$IP/extensions/Wikibase/repo/ExampleSettings.php";
require_once "$IP/extensions/Wikibase/client/WikibaseClient.php";
require_once "$IP/extensions/Wikibase/client/ExampleSettings.php";

Run maintenance scriptsEdit

Finally, run some maintenance scripts -- among them the database update script and the scripts that populate the sites table and the interwiki table.

php maintenance/update.php
php extensions/Wikibase/lib/maintenance/populateSitesTable.php
php extensions/Wikibase/repo/maintenance/rebuildItemsPerSite.php
php extensions/Wikibase/client/maintenance/populateInterwiki.php
By default, running populateSitesTable.php populates the sites table with Wikimedia's project list. See Manual:Sites table#Managing the sites table for how to list non-WMF projects.
Running populateInterwiki.php will overwrite existing links in your interwiki table with Wikipedia values.

Verifying your installationEdit

  • Navigate to the Special:NewItem page in your MediaWiki and create your first Item. Enter a label and optional description and aliases and click Create. You should be redirected to the item page.
 
Special:NewItem special page
 
Your first item
  • Verify that an "Add links" link in the languagelinks section appears in the main page sidebar.
 
First Item page

ReferencesEdit

The Wikibase README file