How to install SemanticMediaWiki
From hjhappel.de
This is quick guide on how to setup a (Semantic) MediaWiki.
Contents |
Installation steps
This guide assumes that you have a running web server (e.g. Apache) with PHP support and a mySQL database running. You will also need the mySQL db root account or a user account with privileges to create tables in a database. If you do not have all this, XAMMP provides you all this out of the box without much installation overhead!
Core MediaWiki
- Download the latest MediaWiki release [1]
- Extract the files to your web browser directory
- Make the
configsubdirectory writable (chmod a+w config) - Hop into your browser, surf into the wiki directory and fill out the configuration form
- After saving, move the file
config/LocalSettings.phpinto the parent directory - Call the wiki URL in your browser to test if it worked
SemanticMediaWiki extension (optional)
- Download the latest release of SemanticMediaWiki [2]
- Probably check if it is compatible with your MediaWiki version (normally the recent versions should be ok)
- Extract the directory
SemanticMediaWikito[wikipath]/extensions/ - Insert at the end of the file
[wikipath]/LocalSettings.php:include_once('extensions/SemanticMediaWiki/includes/SMW_Settings.php');andenableSemantics('example.org');(you may replace example.org with something more meaningful) - In your wiki, log in as a user with admin status and go to the page
Special:SMWAdminto do the final setup steps- If the wiki db-user does not have rights, set db root account credentials in
AdminSettings.phpand callSWM_Setup.phpwith PHP from the command line
- If the wiki db-user does not have rights, set db root account credentials in
Semantic Forms (optional)
- tbd.
Common configuration options
These are common MediaWiki configuration options which can be set in [wikipath]/LocalSettings.php.
You will never need all of these settings. Just copy/paste what is suitable for your case. Most options are sort of self-explanatory.
General
# Error reporting (only useful for debugging) error_reporting( E_ALL ); ini_set( 'display_errors', 1 ); $wgShowExceptionDetails = true; $wgShowSQLErrors = true; # Memory limit ini_set( 'memory_limit', '20M' ); # Uploads $wgEnableUploads = true; $wgFileExtensions = array( 'png', 'jpg', 'gif', 'doc','xls','ppt','pdf' ); $wgAllowExternalImages = true; $wgUseTrackbacks = true; # Enable subpages in the main namespace $wgNamespacesWithSubpages[NS_MAIN] = true; $wgLanguageCode = 'de';
User interface
# Logo & Favicon
$wgLogo = "$wgScriptPath/images/mylogo.gif";
$wgFavicon = "$wgScriptPath/images/favicon.ico";
$wgDefaultSkin = 'monobook';
## For attaching licensing metadata to pages, and displaying an
## appropriate copyright notice / icon. GNU Free Documentation
## License and Creative Commons licenses are supported so far.
$wgEnableCreativeCommonsRdf = true;
$wgRightsPage = ""; # Set to the title of a wiki page that describes your license/copyright
$wgRightsUrl = "http://www.gnu.org/copyleft/fdl.html";
$wgRightsText = "GNU Free Documentation License 1.2";
$wgRightsIcon = "${wgStylePath}/common/images/gnu-fdl.png";
# $wgRightsCode = "gfdl"; # Not yet used
User rights
$wgWhitelistRead = array( "Special:Userlogin", "-", "MediaWiki:Monobook.css" ); $wgGroupPermissions['*' ]['createaccount'] = false; $wgGroupPermissions['*' ]['edit'] = false; $wgGroupPermissions['*' ]['read'] = false; $wgGroupPermissions['user' ]['createaccount'] = true; $wgGroupPermissions['user' ]['edit'] = true; $wgGroupPermissions['user' ]['read'] = true;
This will close your wiki for anonymous users. Only users can create accounts (for other users).
Extension settings
# ParserFunctions (http://www.mediawiki.org/wiki/Extension:ParserFunctions)
require_once("$IP/extensions/ParserFunctions/ParserFunctions.php");
# Search Log (http://www.mediawiki.org/wiki/Extension:SearchLog)
include("$IP/extensions/SearchLog/SearchLog.php");
# InputBox (http://www.mediawiki.org/wiki/Extension:Inputbox)
require_once($IP.'/extensions/InputBox/inputbox.php');
# DynamicArticleList (http://www.mediawiki.org/wiki/Extension:Dynamic_Article_List)
require_once( "extensions/DynamicArticleList/DynamicArticleList.php" );
# http://www.mediawiki.org/wiki/Extension:ArticleComments
include_once("$IP/extensions/ArticleComments/ArticleComments.php");
# http://www.mediawiki.org/wiki/Extension:ScuttleBookmarks
require_once('extensions/scuttlebookmarks/scuttlebookmarks.php');
#SemanticMediaWiki (http://semantic-mediawiki.org/wiki/Semantic_MediaWiki)
include_once("$IP/extensions/SemanticMediaWiki/includes/SMW_Settings.php");
enableSemantics('localhost.org');
$smwgQComparators = '<|>|!|~'; // + pattern search comparator ~ for strings
$smwgLinksInValues = true;
$smwgShowFactbox = SMW_FACTBOX_NONEMPTY;
#SemanticForms (http://www.mediawiki.org/wiki/Extension:Semantic_Forms)
include_once('extensions/SemanticForms/includes/SF_Settings.php');
$sfg24HourTime = true;
#Semantic Result Formats (http://semantic-mediawiki.org/wiki/Semantic_Result_Formats)
require_once("$IP/extensions/SemanticResultFormats/SRF_Settings.php");
#srfInit( array('graph', 'timeline', 'calendar', 'eventline') );
srfInit('all');
LDAP/Actice Directory
# LDAP/AD (http://www.mediawiki.org/wiki/Extension:LDAP_Authentication)
require_once( "$IP/extensions/LDAPAuth/LdapAuthentication.php" );
$wgAuth = new LdapAuthenticationPlugin();
# Uncomment this line to see debug messages:
#$wgLDAPDebug = 10;
#$wgShowExceptionDetails = true;
//The names of one or more domains you wish to use
//These names will be used for the other options, it is freely choosable and not dependent
//on your system. These names will show in the Login-Screen, so it is important that the user
//understands the meaning.
$wgLDAPDomainNames = array("mydomain.com");
//The fully qualified name of one or more servers per domain you wish to use. If you are
//going to use SSL or StartTLS, it is important that the server names provided here exactly
//match the name provided by the SSL certificate returned by the server; otherwise, you may
//have problems.
$wgLDAPServerNames = array( "mydomain.com"=>"ad.mydomain.com");
//Allow the use of the local database as well as the LDAP database.
//Good for transitional purposes.
//Default: false
$wgLDAPUseLocal = true;
//The type of encryption you would like to use when connecting to the LDAP server.
//Available options are "tls", "ssl", and "clear"
//Default: tls
$wgLDAPEncryptionType = array("mydomain.com"=>"clear"); // ssl
$wgLDAPUseSSL = true;
#$wgLDAPBaseDNs = array('mydomain.com' => 'OU=Users,OU=IPE,dc=fzi,dc=de');
$wgLDAPBaseDNs = array('mydomain.com' => 'dc=fzi,dc=de');
$wgLDAPSearchAttributes = array( 'mydomain.com' => 'sAMAccountName');
#$wgLDAPSearchAttributes = array('DOMAINNAME' => 'sAMAccountName');
#$wgLDAPProxyAgent = array("DOMAINNAME"=>"PROXYUSERDN");
#$wgLDAPProxyAgentPassword = array("DOMAINNAME"=>"PROXYUSERPASS");
$wgLDAPUpdateLDAP = array("mydomain.com"=>false);
$wgLDAPAddLDAPUsers = array("mydomain.com"=>false);
//The search string to be used for straight binds to the directory; USER-NAME will be
//replaced by the username of the user logging in.
//This option is not required (and shouldn't be provided) if you are using a proxyagent
//and proxyagent password.
//If you are using AD style binding (TDOMAIN\\USER-NAME or USER-NAME@TDOMAIN) and
//want to be able to use group syncing, preference pulling, etc., you'll need to set
//$wgLDAPBaseDNs and $wgLDAPSearchAttributes for the domain.
#$wgLDAPSearchStrings = array("xxx"=>"xxx\\USER-NAME" );
$wgLDAPSearchStrings = array( "mydomain.com"=>"USER-NAME@mydomain.com");
# restrict to logged in users only
$wgWhitelistRead = array("Special:Userlogout", "Special:Userlogin", "-", "MediaWiki:Monobook.css" );
$wgGroupPermissions['*' ]['createaccount'] = false;
$wgGroupPermissions['user']['createaccount'] = false;
$wgGroupPermissions['sysop']['createaccount'] = false;
$wgGroupPermissions['*' ]['edit'] = false;
$wgGroupPermissions['*' ]['read'] = false;
$wgGroupPermissions['user' ]['edit'] = true;
$wgGroupPermissions['user' ]['read'] = true;
//Option for pulling specific preferences. Available options
//are "email", "realname", "nickname", "language"
//Default: none; disabled
//Available in 1.2a
$wgLDAPPreferences = array( "mydomain.com"=>array( "email"=>"mail","realname"=>"cn") );
