Wikibase

Wikibase is a data repository for Mediawiki.

There are two main methods of installation

Mediawiki extension

Visit the download page and fetch the correct version.

This guide details the steps required to install the extension which is also outlined below with Mediawiki 1.43.

Extract

Enter the mediawiki installation directory and extract the archive into the extensions directory

cd /var/www/htdocs/www.examle.com/w
tar zxvf ~/Wikibase-REL1_43-XXXXXXX.tar.gz -C extensions
chown -R www-data:www-data extensions/Wikibase
Composer

From the mediawiki directory run composer. Composer ought to have been installed earlier.

rm -f composer.lock
composer install --no-dev
Settings

Update the LocalSettings.php file to enable the extension.

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

Run the initial maintenance scripts to build the database tables to prepare the site.

php maintenance/run.php update
php maintenance/run.php ./extensions/Wikibase/lib/maintenance/populateSitesTable.php
php maintenance/run.php ./extensions/Wikibase/repo/maintenance/rebuildItemsPerSite.php
php maintenance/run.php populateInterwiki

Wikibase docker deployment

Github

This setup requires a modern version of docker to be installed and was tested on Debian bookworm on a dual core VM with 12GB of RAM.

Fetch
git clone https://github.com/wmde/wikibase-release-pipeline
Copy config
cd wikibase-release-pipeline/deploy
cp template.env .env
Edit config
vi .env
# Public hostname configuration.

WIKIBASE_PUBLIC_HOST=wikibase.example.com
WDQS_PUBLIC_HOST=query.example.com

# MediaWiki / Wikibase user configuration.

MW_ADMIN_NAME=username
MW_ADMIN_EMAIL=email@example.com
MW_ADMIN_PASS=changemetoatleast10chars

# MediaWiki / Wikibase database configuration.

DB_NAME=dbname
DB_USER=dbuser
DB_PASS=changemetoatleast10chars
Run

Foreground

docker compose up

Update

docker compose up --pull always

Background

docker compose up --detach
Query

Example

PREFIX wd: <https://wikibase.example.com/entity/>
SELECT * WHERE {
  wd:Q1 ?p ?o
}

BUG

After inserting data into an empty instance the query engine will need to be synchronised due to a bug, the following script has been provided.

#! /bin/sh

# Stop the stock updater
docker compose stop wdqs-updater

# Start an updater with force sync settings
docker compose run --rm wdqs-updater /wdqs/runUpdate.sh -h http://\$WDQS_HOST:\$WDQS_PORT -- --wikibaseUrl \$WIKIBASE_SCHEME://\$WIKIBASE_HOST --conceptUri \$WIKIBASE_CONCEPT_URI --entityNamespaces \$WDQS_ENTITY_NAMESPACES --init --start $(date +%Y%m%d000000)

# As soon as you see "Sleeping for 10 secs" in the logs, press CTRL-C to stop it again

# Start the stock updater again
docker compose start wdqs-updater
Delete

Special:Nuke

Uninstall
docker compose down --volumes
rm -vf config/{LocalSettings.php,wikibase-php.ini,wdqs-frontend-config.json}

Resources

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies