Help:Installation

From semantic-mediawiki.org
Jump to: navigation, search
SMW admin manual
Installation
Configuration
Concept caching
Pretty URIs
Using SPARQL and RDF stores
Troubleshooting
Repairing SMW's data
Extensions
Basic extensions
Semantic extensions
SMW user manual

This page describes how to install Semantic MediaWiki 2.0 on a Linux-based server if you have shell access. There is also a help page on how to install on a Windows-based server. This is the strongly recommended installation method. If you do not have shell access. i.e. you cannot use Composer for installation and upgrading, you will have to install the file release as described on this help page on installing the file release of SMW. Please always check the exact requirements and follow the instructions carefully. Make sure you understand the legal disclaimer in the file COPYING before proceeding.

To upgrade a wiki running an older version of SMW, be sure to read the relevant section before starting the upgrade.

Requirements

This section lists the minimum requirements. See also the page on compatibility.

MediaWiki
  • MediaWiki 1.19+ though MediaWiki 1.22+ is recommended. If MediaWiki 1.19.x to 1.21.x is used then the Extension Installer extension 0.2.2+ is additionally required.
PHP
  • PHP 5.3.2+
Relational database
  • MySQL 5.0.2+ though MySQL 5.1+ is recommended (except 5.1.49 to 5.1.52) or
  • SQLite 3.7+ or
  • PostgreSQL 8.3+ though 8.4+ is recommended (beta-support only)

or

Triple store database
  • Jena Fuseki 1.0+
  • Virtuoso Opensource 6.1+
  • 4store 1.1+ (beta-support only)

General notes

  • Semantic MediaWiki has dependencies that will made available during the installation.
  • Individual extensions to Semantic MediaWiki, e.g. Semantic Result Formats may have different requirements.
  • Individual extensions to Semantic MediaWiki may not be compatible with this release (yet). Please see those extensions' documentation pages, or contact the respective developers, for further information.
  • SMW uses the PHP mb_*() multibyte functions such as mb_strpos in the php_mbstring.dll extension. This is standard but not enabled by default on some distributions of PHP. See the PHP manual for details.
  • For installation and upgrade, SMW needs the rights to create new tables (CREATE) and to alter tables (ALTER TABLE). You can remove both rights after SMW is set up. The script "SMW_setup.php" can use the DB credentials from "LocalSettings.php" for this purpose, avoiding the need of extra rights for the wiki DB user.
  • When using the SQL backend (the default data store for SMW), SMW creates and alters temporary tables for certain semantic queries. To do this, the wiki's database user account must have privileges for CREATE TEMPORARY TABLES and DROP. If you don't wish to allow such privileges, you can disable these specific query features by adding the following to "LocalSettings.php":
$smwgQSubcategoryDepth = 0;
$smwgQPropertyDepth    = 0;
$smwgQFeatures         = SMW_ANY_QUERY & ~SMW_DISJUNCTION_QUERY;
$smwgQConceptFeatures  = SMW_ANY_QUERY & ~SMW_DISJUNCTION_QUERY & ~SMW_CONCEPT_QUERY;


  • When using a SPARQL backend, SMW uses the CURL functions of PHP. These functions may have to be enabled/installed to be available.

Installation

MediaWiki 1.22+
  1. Install Composer - please follow the instructions at installing Composer to do this.
  2. Run the installation script[1] from the base directory[2] of your MediaWiki installation:[3]
    php composer.phar require mediawiki/semantic-media-wiki "~2.0"
  3. Run the setup script from the base directory[2] of your MediaWiki installation:
    php maintenance/update.php
  4. Add a call to enableSemantics() to the end of the "LocalSettings.php" file. enableSemantics() takes in the domain name of the wiki; a wiki located at "example.org", for instance, should have the following call:
    enableSemantics( 'example.org' );
    The calls require_once … must neither be added for Semantic MediaWiki nor for Validator since Composer loads the extensions automatically.
  5. Add optional settings[4] apart from one exception[5] to the "LocalSettings.php" file as desired below the enableSemantics() call.
  6. In case you want to use additional semantic extensions which are not installed via Composer like e.g. Semantic Forms you still have to invoke them by adding the respective line require_once … to you "LocalSettings.php" file below the enableSemantics() call.
  7. See the page "Special:Version" on your wiki to verify that the extension is successfully installed.
  8. Test your installation as described on the help page about testing SMW.
  9. Done!
MediaWiki 1.19.x to 1.21.x
  1. Install the "Extension Installer" extension - see installing "Extension Installer" for how to do this.
  2. Add the following line to the "require" section of the "composer.json" file in the …/extensions/ExtensionInstaller/ directory.[6]
    "mediawiki/semantic-media-wiki": "~2.0"
  3. Run the installation script from the …/extensions/ExtensionInstaller/ directory:[3]
    php composer.phar install
  4. Run the setup script from the base directory[2] of your MediaWiki installation:
    php maintenance/update.php
  5. Add a call to enableSemantics() to the end of the "LocalSettings.php" file. enableSemantics() takes in the domain name of the wiki; a wiki located at "example.org", for instance, should have the following call:
    enableSemantics( 'example.org' );
    The calls require_once … must neither be added for Semantic MediaWiki nor for Validator since Composer loads the extensions automatically.
  6. Add optional settings[4] apart from one exception[5] to the "LocalSettings.php" file as desired below the enableSemantics() call.
  7. In case you want to use additional semantic extensions which are not installed via Composer like e.g. Semantic Forms you still have to invoke them by adding the respective line require_once … to you "LocalSettings.php" file below the enableSemantics() call.
  8. See the page "Special:Version" on your wiki to verify that the extension is successfully installed.
  9. Test your installation as described on the help page about testing SMW.
  10. Done!

Upgrading

Use these instructions to update an existing SMW installation.

Upgrading from SMW 1.9.x (MW 1.19+)
  1. Backup your database and installation.
  2. Change the following line in the "require" section of the "composer.json" file in the …/extensions/ExtensionInstaller/ directory (MW 1.19.x - MW 1.21.x)[7] or from the base directory (MW 1.22+)[2].
    "mediawiki/semantic-media-wiki": "~1.9"
    to
    "mediawiki/semantic-media-wiki": "~2.0"
  3. Run the update script from the base directory[2] of your MediaWiki installation:[3]
    php composer.phar update
  4. See the page "Special:Version" on your wiki to verify that the extension was successfully updated.
  5. Run the setup script from the base directory[2] of your MediaWiki installation:
    php maintenance/update.php
  6. Run the refresh database script from the base directory[2] of your MediaWiki installation:[8]
    php extensions/SemanticMediaWiki/maintenance/SMW_refreshData.php -d 50 -v
  7. Done!
Upgrading from SMW 1.9.x (MW 1.22+)
  1. Backup your database and installation.
  2. Run the update script from the base directory[2] of your MediaWiki installation:[3]
    php composer.phar require mediawiki/semantic-media-wiki:~2.0 --update-with-dependencies
  3. See the page "Special:Version" on your wiki to verify that the extension was successfully updated.
  4. Run the setup script from the base directory[2] of your MediaWiki installation:
    php maintenance/update.php
  5. Run the refresh database script from the base directory[2] of your MediaWiki installation:[8]
    php extensions/SemanticMediaWiki/maintenance/SMW_refreshData.php -d 50 -v
  6. Done!
Upgrading from SMW 1.8.x
  1. Backup your database and installation.
  2. Delete the directories SemanticMediaWiki/ and Validator/ from the …/extensions/ directory.
  3. Remove the formerly required invocations of "Semantic MediaWiki" and "Validator" from the "LocalSettings.php" file, i.e. the following two lines:
    require_once "$IP/extensions/Validator/Validator.php";
    require_once "$IP/extensions/SemanticMediaWiki/SemanticMediaWiki.php";
  4. Re-install Semantic MediaWiki as described in the section on installing SMW.[9]
  5. Run the refresh database script from the base directory[2] of your MediaWiki installation:[8]
    php extensions/SemanticMediaWiki/maintenance/SMW_refreshData.php -f -d 50 -v
  6. Done!
Upgrading from ≤ SMW 1.7.x

Please upgrade to SMW 1.8.0.5 first, as described on the help page on upgrading to SMW 1.8.x.

Updating SMW 2.x

Use these instructions to update an existing SMW 2.x installation from e.g. 2.0

MediaWiki 1.22+
  1. Backup your database and installation.
  2. Run the update script from the base directory[2] of your MediaWiki installation:[3]
    php composer.phar update
  3. See the page "Special:Version" on your wiki to verify that the extension was successfully updated.
  4. Run the setup script from the base directory[2] of your MediaWiki installation:
    php maintenance/update.php
  5. Run the refresh database script from the base directory[2] of your MediaWiki installation:[8]
    php extensions/SemanticMediaWiki/maintenance/SMW_refreshData.php -d 50 -v
  6. Done!
MediaWiki 1.19.x to 1.21.x
  1. Backup your database and installation.
  2. Run the update script from the …/extensions/ExtensionInstaller/ directory:[3]
    php composer.phar update
  3. See the page "Special:Version" on your wiki to verify that the extension was successfully updated.
  4. Run the setup script from the base directory[2] of your MediaWiki installation:
    php maintenance/update.php
  5. Run the refresh database script from the base directory[2]:[8]
    php extensions/SemanticMediaWiki/maintenance/SMW_refreshData.php -d 50 -v
  6. Done!

Troubleshooting

After the upgrade of an existing SMW installation the following messages can occur which solely depend on the configuration of the "LocalSettings.php" file:

Warning: Class '…' not found in …
This kind of message appears if the Validator extension is still explicitly invoked. To resolve this the following line has to be removed:
require_once "$IP/extensions/Validator/Validator.php";
Notice: Use of undefined constant …
This kind of message appears because SMW namespace constants (SMW_NS_PROPERTY, SMW_NS_TYPE and SMW_NS_CONCEPT) are delayed due to the parameter $smwgNamespaceIndex being a prerequisite and its initialization has to happen first it can be processed. To resolve this you have to add
enableSemantics( 'example.org' );
prior to any parameter (e.g. $wgContentNamespaces, $wgNamespacesToBeSearchedDefault and $wgNamespaceProtection) making reference to these namespace constants. In case you choose to manually set $smwgNamespaceIndex to something other than the default value of 102, you must do this above the enableSemantics() call.
Fatal: Call to undefined function enableSemantics() …
This kind of message appears for MW ≤ 1.21.x if the Extension Installer extension is included after the call to enableSemantics() (see above). Make sure that the call to include Extension Installer comes first.


After updating an existing SMW 1.9.0 installation the following messages may occur:

Database error: A database query error has occurred. This may indicate a bug in the software.
This error appears after an upgrade from SWM 1.9.0 to 1.9.1 when moving a page and if you have not updated the semantic store. To resolve this run the setup script from the base directory[2] of your MediaWiki installation:
php maintenance/update.php

Notes

  1. Note that, if you have Git installed, it's recommended to install composer with the "--prefer-source" flag, so that Composer uses Git to download the code. In other words, instead of calling "composer install" or "php composer.phar install", as that page states, you should call "composer install --prefer-source" or "php composer.phar install --prefer-source".
  2. 2.00 2.01 2.02 2.03 2.04 2.05 2.06 2.07 2.08 2.09 2.10 2.11 2.12 2.13 2.14 2.15 2.16 This is the directory which contains the "LocalSettings.php" file.
  3. 3.0 3.1 3.2 3.3 3.4 3.5 In case you installed Composer "globally" on your server, you will have to drop the php and .phar particles from the command.
  4. 4.0 4.1 See the help page on configuring SMW. Usually only a few configuration parameters have to be changed if there is a need to do so at all.
  5. 5.0 5.1 If you manually set $smwgNamespaceIndex to something other than the default value of 100, you must do this above the enableSemantics() line instead. Make sure that the value set is ≥ 100 as well as an even number.
  6. See also the example "composer.json" file, which already contains the line to be added here.
  7. See also the example "composer.json" file, which already contains the line to be added here.
  8. 8.0 8.1 8.2 8.3 8.4 This is an optional step to take to assure that the semantic store is valid and up to date.
  9. Please refer to the applicable section, i.e. "with shell access / without shell access".

Video tutorial

Note Note: This tutorial also applies to SMW 2.0

This documentation page applies to all SMW versions from 2.0 to the most current version.
Other versions: 1.9.0 – 1.9.21.8.0 – 1.8.01.7.1 – 1.7.1 […]      

Help:Installation en 2.0