Help:Installation/Windows environment
Installation | |
---|---|
Installing Semantic MediaWiki on a Windows Server. | |
Further Information | |
Installation type: | |
Installation method: | |
MediaWiki version: | |
Table of Contents | |
Installing Semantic MediaWiki as of version 1.9 on a Windows Server will require a different approach on what most of you are used to. Because of ever increasing dependencies within SMW it has become more difficult to get a stable version up and running. Especially when you want to or are used to run the development version of SMW. Because of that Composer is required when installing SMW 1.9 and higher. These instruction explain how to install SMW as of 1.9 on a Windows box using Composer.
Platform compatibility
The compatibility table is there for reference only. If you want to install SMW as explained on this page (with Composer) you need to run SMW 1.9 as a minimum.
SMW version | Release date | PHP | MediaWiki | Composer | Validator |
---|---|---|---|---|---|
Semantic MediaWiki 4.2.0 | 18 July 2024 | 7.4.x - 8.8.x | MW 1.35.0 - 1.41.x | Required | 2+ (handled by Composer) |
Semantic MediaWiki 4.1.3 | 17 February 2024 | 7.4.x - 8.1.x | MW 1.35.0 - 1.39.x | Required | 2+ (handled by Composer) |
Semantic MediaWiki 4.1.2 | 29 July 2023 | 7.4.x - 8.1.x | MW 1.35.0 - 1.39.x | Required | 2+ (handled by Composer) |
Relational database support
SMW version | MySQL | SQLite | PostgreSQL |
---|---|---|---|
Semantic MediaWiki 4.2.0 | 5.5.8+ | 3.3.7+ | 9.5.0+ |
Semantic MediaWiki 4.1.3 | 5.5.8+ | 3.3.7+ | 9.5.0+ |
Semantic MediaWiki 4.1.2 | 5.5.8+ | 3.3.7+ | 9.5.0+ |
Requirements[edit]
You need a running (working) Wiki. Consider updating MediaWiki to the latest stable version on a existing Wiki. When you are installing / updating SMW on existing Wiki back up your Wiki and its DB first! Before you start installing SMW you will need the following software / extension(s) to be installed on your Wiki server. Only start installing SMW when you have done this. Your server also needs to be connected to the Internet.
Program Extension |
description | Remark |
---|---|---|
Composer | Dependency Manager for PHP | |
Git | Distributed version control system | Note: At this moment Git is still required to install SMW. In the future it will be possible to use Composer without having Git installed! |
Extension Installer | MediaWiki extension | Use only for MediaWiki 1.19 / 1.20 and 1.21 to install extensions with Composer [1]. You do not need Extension Installer when you are using MediaWiki 1.22 or later. |
Install Composer[edit]
Download the installer from http://getcomposer.org/Composer-Setup.exe and run it. The installer will download composer for you and set up your PATH environment variable so you can simply call composer from any directory.
Install Git[edit]
Download the installer from http://git-scm.com/download/win and run the installer.
Install Extension Installer[edit]
Note: You do not need Extension Installer when you are using MediaWiki 1.22 or later!
Download Extension Installer from the MediaWiki wiki and follow the instructions on how to install.
Install / Update SMW with Composer[edit]
When using Composer to install extensions there is no need to edit LocalSettings.php
to enable them. All extensions that support Composer will auto-load. MediaWiki provides direct support for composer as of version 1.22! However, you can edit LocalSettings.php
after setup to change extension settings, see Configuration.
When you are installing SMW on a fresh MW installation start at step 3.
- Delete all required extensions for SMW from the
extensions
directory of your wiki installation these are:SemanticMediaWiki
Validator
DataValues
- Delete all lines from required SMW extensions from
Localsettings.php
that load SMW, they are no longer needed. These are:require_once( "$IP/extensions/DataValues/DataValues.php" );
require_once( "$IP/extensions/Validator/Validator.php" );
include_once( "$IP/extensions/SemanticMediaWiki/SemanticMediaWiki.php" );
- Add the following line(s) to the end of your
LocalSettings.php
file:$smwgNamespaceIndex = ???; /** Keep $smwgNamespaceIndex when set to a non default value. Should be before enableSemantics! Not necessary on a fresh MW installation. */
enableSemantics('your.wiki.blabla'); /** Adjust to yours.*/
- In a terminal screen cd to the root of your wiki and execute the following commands:
- For the latest stable SMW release use:
composer require mediawiki/semantic-media-wiki
"~4.2"
- For the SMW development version use:
composer require mediawiki/semantic-media-wiki "dev-master"
- For the latest stable SMW release use:
- In a terminal screen cd to the
maintenance
directory of you wiki and runphp update.php
to update your database. - On an existing wiki you could rebuild your semantics. Note: Please read Repairing data and data structures first so you know what this will do! cd to
extensions\SemanticMediaWiki\maintenance
and execute the refreshData php script:php SMW_refreshData.php -f -d 50 -v
If you already have SMW installed via Composer, upgrading to a new version can be as simple as running "composer update". However, you may need to modify your Composer.json file first to specify which version of SMW you want installed.
Windows does not always recognize the changes made by Composer. In order to make SMW work after an upgrade, you may need to update the "modified date" of each file in the extensions/SemanticMediaWiki directory. To do this you need a bash emulator (e.g. a terminal where you can use Unix commands). If you have Git installed (which you need to use Composer) you probably have Git Bash. In your bash emulator change directory to the MediaWiki extensions directory, then run:
find SemanticMediaWiki/. -exec touch {} \;
This will find every file and directory in the SemanticMediaWiki directory and execute the "touch" command, updating it's modification date.
Install / Update SMW extensions that support Composer[edit]
You can, if you need them, install some SMW extension with Composer. When you are installing SMW on a fresh MW installation or you never used these extension before go to step 3.
- In explorer delete all older SMW extensions from the extensions directory of your wiki installation. These are:
Maps
SemanticMaps
SemanticResultFormats
- Delete all lines from SMW extensions from
Localsettings.php
that load SMW extensions, they are no longer needed. These are:require_once( "$IP/extensions/Maps/Maps.php" );
require_once( "$IP/extensions/SemanticMaps/SemanticMaps.php" );
include_once( "$IP/extensions/SemanticResultFormats/SemanticResultFormats.php" );
- In a terminal screen cd to the root of your wiki and execute the following commands to install the extensions you need:
composer require mediawiki/maps "*"
composer require mediawiki/semantic-maps "*"
Note: You need to install Maps first!composer require mediawiki/semantic-result-formats "*"
Install / Update other SMW extensions through Git[edit]
You can also install these extensions by downloading them from MediaWiki. When you are using Git, in a terminal screen cd to the extensions directory of your wiki and execute the following commands for the extensions you need or want to update, some examples below:
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SemanticForms.git
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SemanticFormsInputs.git
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SemanticDrilldown.git
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/AdminLinks.git
...
Of course, you then have to edit LocalSettings.php
to enable these extensions. For documentation on this look on the individual extension pages on the MediaWiki wiki.
Downgrading[edit]
If for some reason you need to downgrade from one Composer-supported version of SMW to another Composer-supported version, perform the following:
- Update Composer.json to the state the specific version of SMW you want installed (e.g. "2.0" is specific, versus "~2.0" will install the latest version less than 3.0).
- Run "composer update"
- You may need to run "composer dump-autoload --optimize"