Wikibase/Installation

Installation using Composer
The easiest way to install Wikibase is to use Composer to install all the dependencies.

First [//getcomposer.org/download get composer] by following [//getcomposer.org/doc/00-intro.md its installation guide]: Next clone the Wikibase Repository in the extensions folder of your MediaWiki installation:

If you want to get a version that works with a specific release of MediaWiki (say if you want to stick to released versions), use a command like: This fetches the version that works with MediaWiki 1.26.

or to work with gerrit:

Then run composer inside the folder of your Wikibase installation to get all dependencies:

If you installed composer by a different method than suggested above (e.g. by using your linux distributions package manager), your command might be just composer install.

If you plan to contribute to Wikibase and its components run the following command instead to also get the sources of the components:

Note that it might make be necessary to increase the timeout if you get an error like "exceeded the timeout of 300 seconds". If so try a rerun, but wait until the present download are finished and make a note on how much time the download actually needs to complete. If you rerun the command before the previous are done, then you will get a "Could not delete". When you have an estimate on how much time the download needs, then add something like:

After that adjust your LocalSettings.php to enable Wikibase. In order to enable a Wikibase Repository, insert the following:

To enable a Wikibase Client, insert the following instead:

You then need to run the database update script (in the folder of your MediaWiki installation):

And finally populate the sites table:

Note: If you're installing a client you'll need to populate the interwiki table too:

And make sure your wiki id is in the sites table if you are installing a client, or simply changing it to one of the entries that is there by default:

That's it! Wikibase should now be installed in your MediaWiki.

Installation without composer
If you cannot install Wikibase using composer for any reason, there are nightly builds on labs: bene/wikibase. Download the build in one of the available formats and unpack it into the  folder. However, using composer is encouraged because it simplifies updating a lot.

Vagrant
There is a Wikidata role in MediaWiki-Vagrant which installs Wikibase using the Wikidata Build Resources. The build resources are same as used for Wikidata, itself, including related components like the Property Suggester and badges components. In vagrant, everything is installed using composer's --prefer-source option so that you can make changes in Wikibase or other components and submit the changes.

When you use Vagrant as described at MediaWiki-Vagrant, then composer is already available.

Note that you must adjust the composer timeout for this method too, that is after you have created the instance but before you create the role.

Keeping up to date
To update your Wikibase installation, you probably want to update Mediawiki, too. How to update your Mediawiki installation. Then just change in the directory of your Wikibase installation and from the command line: git pull Run the update script as mentioned before. php maintenance/update.php --quick It's possible that you have to update the composer to run the maintenance script. The command line will show you an error. Use php composer.phar update and run the script again.

Troubleshooting
If you get an error like "Invalid callback Wikibase\RepoHooks::onSetupAfterCache", then this is probably because you enabled Wikibase but didn't run  yet. (and then run update.php again to install Wikibase tables)

[85c536d8] /wiki/Main_Page? MWException from line 184 of /Library/WebServer/Documents/php-master/includes/Hooks.php: Invalid callback Wikibase\RepoHooks::onSetupAfterCache in hooks for SetupAfterCache Backtrace:


 * 1) 0 /Library/WebServer/Documents/php-master/includes/Setup.php(587): Hooks::run(string)
 * 2) 1 /Library/WebServer/Documents/php-master/includes/WebStart.php(121): require_once(string)
 * 3) 2 /Library/WebServer/Documents/php-master/index.php(43): require(string)
 * 4) 3 {main}