|This page contains outdated information and is thus OBSOLETE!|
Help:Installation en 1.2 1.2.2
|SMW admin manual|
|Using SPARQL and RDF stores|
|Repairing SMW's data|
|SMW user manual|
|Table of Contents|
This page describes how to install Semantic MediaWiki 1.2 after having downloaded it (see the bottom of this page for other versions). Installation notes change from version to version. The file INSTALL shipped with SMW contains instructions for the particular version you may have downloaded.
For installing SMW, please check the exact requirements and follow the instructions carefully. The installation does no irreversible changes to your MediaWiki database (it just adds some tables that can be deleted again). However, there is currently no automated process to remove annotations from articles texts in the case that Semantic MediaWiki is to be uninstalled again, but one could achieve this with some script that eliminates annotations on editing.
Make sure you understand the legal disclaimer in the file COPYING.
- MediaWiki 1.11.* or greater (tested from 1.11.0 to 1.13alpha (r37479)).
- PHP 5.x or greater installed and working
- MySQL >= 4.0.14 (version required by MediaWiki)
- SMW currently has no working Postgres support. It could be done if someone cares to support this action.
- 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). Both can be removed again after SMW was set up. The script SMW_setup.php can use the DB credentials from AdminSettings.php for this purpose, avoiding the need of extra rights for the wiki DB user.
- SMW creates and alters temporary tables for certain semantic queries. To do this, your wikidb user must have privileges for CREATE TEMPORARY TABLES. If this is not desired, the SMW features which require this right can be disabled 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;
If you upgrade an existing installation of Semantic MediaWiki, also read the remarks in the section Notes on Upgrading below! Installing SMW basically requires three (or four) easy steps:
(1) Copy files. Extract the downloaded archive, or check out the current files from SVN to obtain the directory "SemanticMediaWiki" that contains all relevant files. Copy this directory to "[wikipath]/extensions/" (or extract/download it to this place). We abbreviate "[wikipath]/extensions/SemanticMediaWiki" as "[SMW_path]" below.
(2) Enable the extension. Insert the following two lines into the file "[wikipath]/LocalSettings.php":
where example.org should be replaced by your server's name (or IP address). This string is only used as a globally unique name for identifying the wiki's exported data on the Semantic Web, and a valid server name works very well for that purpose. There is no need to worry if a wiki has more than one server name – just pick one.
(3) Perhaps Adjust namespaces. Semantic MediaWiki uses ten additional namespace indexes, in the range from 100 to 109. 100 and 101 are only needed if $smwgSMWBetaCompatible is set. 106 and 107 are reserved for the SemanticForms extension and not used by SMW. If you have your own custom namespaces, you have to set the parameter $smwgNamespaceIndex before including SMW_Settings.php. See the documentation $within SMW_Settings.php for details. If you add more namespaces later on, then you have to assign them to higher numbers than those used by Semantic MediaWiki.
Semantic MediaWiki only evaluates semantic annotations in some namespaces. For example, by default it ignores semantic annotations in talk pages. If you want to change the namespaces with annotations (likely if you have added your own custom namespaces), then you have to change the array variable $smwgNamespacesWithSemanticLinks in SMW_Settings.php.
(4) Setup database. In your wiki, log in as a user with admin status and go to the page "Special:SMWAdmin" to do the final setup steps. This can also be done with the command-line PHP script SMW_setup.php. See [SMW_path]/maintenance/README for details on runnning this.
There is currently no working Postgres support. If you need that, please contact the developers and support them in adjusting SMW appropriately.
Testing your Installation
If you are uncertain that everything went well, you can do some testing steps to check if SMW is set up properly.
Go to the Special:Version page and you should see Semantic MediaWiki (version nn) listed as a Parser Hook and several wfSMWXxxx functions listed as Extension Functions.
Create a regular wiki page named "TestSMW", and in it enter the wiki text
Property test: [[testproperty::Dummypage]]
when you preview and save the page, the SMW "Factbox" should appear showing the Testproperty and Dummypage both as links. If you don't get these results, check the steps in the Installation section, consult the FAQ section, then contact the user support list (see the Contact section).
Running SMW on older versions of MediaWiki
In general, it is not recommended to run older versions of MediaWiki, since every new release brings also security fixes. If your site is still running on PHP4, SMW is not supported. It would hardly be possible to backport the code to the old PHP version. If you have PHP5 but an older MediaWiki version, additional patches/modifications might be needed. Download an older release of SMW and have a look at the included INSTALL instructions to find out whether other changes are recommended therein.
Notes on Upgrading
The following sections describe how to upgrade from earlier versions of SMW. SMW 1.2 introduces a new internal store, and there are two basic options for upgrading wikis:
- Edit LocalSettings.php to contain $smwgDefaultStore = 'SMWSQLStore'; to continue using the old store. If you run a wiki farm, you can also set this option globally for all wikis by changing the default setting in SemanticMediaWiki/includes/SMW_Settings.php.
- Upgrade to the new store.
If you run many wikis on one site, you can decide for each wiki individually what to do, even if all wikis use the same SMW installation. If you continue using the old store, everything will continue to work as before, but some new features and performance improvements do not become available. It is generally a good idea to first set SMW to use the old store, and then to upgrade to the new store in the background when time permits. This way, the upgrade can be achieved without even temporal unavailability of SMW data. If you have set $smwgDefaultStore = 'SMWSQLStore'; as a global default in SemanticMediaWiki/includes/SMW_Settings.php, then you can change individual sites to the new store with the option $smwgDefaultStore = 'SMWSQLStore2';.
Even if the old store is used, it is always a good idea to go to Special:SMWAdmin and to press the setup button again, just in case some details changed since your last SMW installation.
There are also few less common configuration options of SMW that have changed. Read #Changed configuration options to find out if any change in our config file is needed.
Upgrading to the new store
After file installation, add the setting $smwgDefaultStore = 'SMWSQLStore'; to your LocalSettings.php (see above). This uses the existing old store, which is slower and has less features, but the wiki wil stay fully functional while you upgrade.
To upgrade to the new store, do the following:
(1) Login to your server, and change directory to [wikipath]/maintenance
(2) Run php SMW_setup.php -b SMWSQLStore2 and follow its progress.
(3) Run php SMW_refreshData.php -tpv -b SMWSQLStore2 and follow its progress.
(4) Run php SMW_refreshData.php -v -b SMWSQLStore2 and follow its progress.
After completing this successfully, remove $smwgDefaultStore = 'SMWSQLStore'; from your LocalSettings.php again. Then check whether the contents of the wiki is displayed properly. In case of problems, you can always go back to the old store again by setting $smwgDefaultStore as before. If the new store works well, you can free the space taken by the old store with
php SMW_setup.php --delete -b SMWSQLStore
If you run a version of SMW that is 0.7 or older, please also see the additional upgrade notes explained in Help:Installation 1.1. The above is still necessary and will leave you with a wiki that basically works, given that you set $smwgSMWBetaCompatible as described below.
Changed configuration options
Some configuration options (used in LocalSettings.php) have changed since SMW 1.0. All settings are documented in detail in the file SMW_Settings.php.
- If your wiki uses <ask> syntax or the Relation: namespace, you may want to set $smwgSMWBetaCompatible = true; before the line including SMW_Settings.php in LocalSettings.php. Consider changing <ask> to #ask to be able to drop SMW beta compatibility.
- If you had a setting $smwgQDisjunctionSupport = false, then you now need the following settings:
$smwgQFeatures = SMW_ANY_QUERY & ~SMW_DISJUNCTION_QUERY; $smwgQConceptFeatures = SMW_ANY_QUERY & ~SMW_DISJUNCTION_QUERY & ~SMW_CONCEPT_QUERY;
- $smwgQEqualitySupport is one of SMW_EQ_NONE, SMW_EQ_SOME, SMW_EQ_FULL (it was true or false until SMW 1.0 RC1-3).
- $smwgQDefaultNamespaces is now NULL by default, so that all namespaces are queried. The default in SMW RC 1-3 was "array(NS_MAIN, NS_IMAGE)".
- $smwgQDefaultLinking now defaults to 'all' such that all query results are linked. This is not a performance issue any more. The default until SMW RC 1-3 was 'subject'.
If you currently set any of these parameters in your LocalSettings.php, you need to update this file. Please see SMW_Settings.php for more documentation on the available parameters.