Projekt:Installation: Unterschied zwischen den Versionen

CamNet - das Wiki
 
imported>Oetterer
 
Zeile 1: Zeile 1:
This is an installation instruction for this MediaWiki platform. All in all you should be done whith this when you read this page. However, it serves as a template to edit when the platform is modified. And you can use it as a cheatsheet or checklist to verify your installtion.
This is an installation manual for a MediaWiki platform. For this project, you are probably done with all of this. However, it serves as a guideline for further mediawiki projects. And you can use it as a cheatsheet or checklist to verify your installtion.
 
== What to do ==
# get the files via git <code>git clone --branch &lt;branch&gt; --recursive https://imtdev.uni-paderborn.de/git/mediawiki/mediawiki.git &lt;project&gt;</code>
# set up your apache with <code>DocumentRoot /var/www/&lt;project&gt;/mediawiki</code>, adjust ''php_admin_value open_basedir, upload_tmp_dir, and session.save_path'' accordingly
# in <code>_config</code> create a <code>LocalSettings_host.php</code> from the shipped ''.sample'' file. Adjust setting for <code>$wgServer</code> if needed
# in <code>_opt/scripts</code> run script <code>init</code>


== Get the files ==
== Get the files ==
Either use a git repository or get a zip file with all the necessary files. Using git at the IMT, the call should look something like this:
Either use a git repository or get a zip with all the necessary files. Using git at the IMT, the call should look something like this:


{{code|lang=bash|code=
{{code|lang=bash|code=
git clone --recursive https://imtdev.uni-paderborn.de/git/mediawiki/mediawiki.git <wikiname>
git clone --recursive https://imtdev.uni-paderborn.de/git/mediawiki/mediawiki.git <project>
}}
}}


The <code>--recursive</code> is important, otherwise you are missing all the subprojects' files.
The <code>--recursive</code> is important, otherwise you are missing all the submodules' files.
 
{{ambox|type=content|text=If git hangs, make sure your host is in '''imtdev's acls'''.}}


Once you cloned or unziped the files, your file structure should look something like this:
When using a project branch (like ''smwcore'', ''hilfe'', or ''imtkb'') you can specify it on clone directly with


{{code|io|
drwxr-xr-x  9 www-data www-data 4096 Dec  9 10:12 .git                          // your repository files
-rw-r--r--  1 www-data www-data  331 Dec  8 08:29 .gitignore                    // ignore files for your repo
-rw-r--r--  1 www-data www-data  101 Dec  3 09:50 .gitmodules                    // listing of all submodules
drwxr-xr-x  2 www-data www-data 4096 Dec  7 15:03 _config                        // this is where your config files are located
drwxr-xr-x 39 www-data www-data 4096 Nov 16 09:49 _extensions                    // this is the assortment of available extensions
drwxr-xr-x 24 www-data www-data 4096 Sep  9 12:45 _images                        // this is your image directory, almost empty after unpacking
drwxr-xr-x  6 www-data www-data 4096 Dec  3 09:50 _opt                          // this is where you find all auxilliary files
lrwxrwxrwx  1 www-data www-data  17 Sep  9 12:45 mediawiki -> mediawiki-1.23.10 // a symbolic link to the current mediawiki core software
drwxr-xr-x 12 www-data www-data 4096 Sep 11 10:49 mediawiki-1.23.10              // the current mediawiki core software
drwxr-xr-x  2 www-data www-data 4096 Dec  9 10:16 php_temp                      // folder for temporary files and session data
}}
Placing the config files, extensions and uploaded files in directories parallel to the mediawiki software and not (as per default) inside it, brings certain benefits:
* quicker access via shell
* tidies up the config files
* shared filebase accross different versions of mediawiki core
* easy way to upgrade the core
* keep core and additional (user provided and defined) data separated
However there is one drawback: When calling maintenance scripts in an extension directory, this will most probably fail. The script tries to "guess" the location of the mediawiki core by assuming it in the correct relative position to the script. Since with our installation this isn't the case, the scripts returns an error. This however is easily remedied. Just set an environment variable via:
{{code|lang=bash|code=
{{code|lang=bash|code=
export MW_INSTALL_PATH=/var/www/<wikiname>/mediawiki
git clone --branch <branch> --recursive https://imtdev.uni-paderborn.de/git/mediawiki/mediawiki.git <project>
}}
}}
Choose the path according to your installation. You can do this in your server startup config or simply everytime you call a maintenance script. Which won't be that often. But we'll come back to this in a little while, we don't need it now.


=== Auxilliary files ===
{{ambox|type=content|text=If git hangs, make sure your host is in '''imtdev's acls'''.}}
In <code>./_opt</code> you can find a bunch of additional files. These are not required for your installation to work, but provide some additional capabilities. Structure is as follows:
 
{{code|lang=io|code=
-rw-r--r-- 1 www-data www-data  58 Nov 16 09:49 _admin_login.php              // located in this file are the credentials for the local admin login
drwxr-xr-x 3 www-data www-data 4096 Dec  3 09:52 bot                            // a bot adapted to a imt mediawiki project. see there for more information
drwxr-xr-x 5 www-data www-data 4096 Nov 17 09:17 crons                          // here you can place cron jobs in subdirectories. put a script for each job in one of the
                                                                                // subdirs minutely, hourly, daily. They will called automatically from the system.
drwxr-xr-x 6 www-data www-data 4096 Dec  8 13:16 init                          // contains files and dumps for initial content
drwxr-xr-x 2 www-data www-data 4096 Dec  8 14:03 scripts                        // contains helper scripts
}}
 
=== Available helper scripts ===
These scripts are available for you to help you in your wiki related tasks. Most of them have a help page. Just call the script with parameter <code>--help</code>.
 
{{code|lang=io|code=
-rwxr-xr-x 1 www-data www-data  6311 Dec  8 11:03 create_dumps                  // takes all *.list files in the current dir (except protection.list) and creates an xlm file each
-rwxr-xr-x 1 www-data www-data  549 Dec  7 09:45 fetch_sources_for_1.23        // call this with subversion number as parameter to get new sources.
                                                                                // should not be necessary, if you update your repo regularly
-rwxr-xr-x 1 www-data www-data  878 Dec  7 09:46 get_new_version_going          // a small script to initialize a new version (update, not upgrade) of the mediawiki software
-rw-r--r-- 1 www-data www-data    18 Dec  8 08:28 .gitignore                    // a list of files to ignore in the repo
-rwxr-xr-x 1 www-data www-data  4720 Dec  8 12:57 import_dumps                  // imports all .xml files in the current directory or the supplies xml file.
-rwxr-x--- 1 www-data www-data 16364 Dec  8 13:13 init                          // helps you to get your installation going
-rw-r----- 1 www-data www-data  579 Dec  8 11:37 init.config                    // holds configuration for your initialization
-rw-r--r-- 1 www-data www-data    11 Dec  8 14:03 init.lock                      // after you initialized your system, this file will be present
                                                                                // to warn you, if you accidently execute init a second time
-rwxr-xr-x 1 www-data www-data  5031 Dec  8 11:09 protect_pages                  // looks for a list of pages to protect in the current dir and protects them
-rwxr-xr-x 1 www-data www-data  1194 Nov 16 09:49 tweak_timestamp                // a crude helper scripts that simply updates all timestamps in a
                                                                                // mediawiki dump xml file. so that, after an import, the imported article will show
-rwxr-x--- 1 www-data www-data  4357 Dec  8 13:33 update_content                // creates up-to-date versions of your project's dump files, as long as there
                                                                                // are *.list files present in _opt/init/local_content
-rwxr-x--- 1 www-data www-data  493 Dec  8 07:03 url                            // returns your projects url
-rw-r--r-- 1 www-data www-data  182 Dec  8 13:11 url.config                    // present after running init for the first time.
                                                                                // here you can customize your project's url
}}
 
==== create_dumps ====
Usage:
* Switch to a dir that contains at least one file ending with <code>.list</code>
* or call with the name of a file as argument
 
The script then produces an xml dump (for all list files or the supplied file only). As default, only the current revision will be dumped, use argumment <code>--full</code> to geht the file's full history. The script processes the list file(s) and
* ignores empty lines or lines beginning with a #
* dumps all contents of a given category, if the line starts either with "Category:" or the equivalent of your locale. Excludes subcategories
* dumps the category page, if page name starts with a <code>:Category:</code>
* in every other case, dumps the pagename.
Example:
{{code|lang=bash|code=
# this is a comment.
# btw: the following line will also be ignored


# normal page, will be dumped:
See [[Project:Software overview]] for more information about the layout of your wiki software.
Normal Page
# will also be dumped normally:
Namespace4:Funnypage
# and again: dumped directly, no special treatment:
:Category:Funny pages
# now the interesting part
# this category will be dumped. also: all pages, contained in this category, except subcategories
Category:Interesting facts
}}
 
Note: This script uses the url, supplied in your <code>LocalSettings_host.php</code>. To be more specific, it uses the url the helper script [[#url|url]] returns. See there for more information.
 
More help is available via parameter <code>--help</code>.
 
==== fetch_sources_for_1.23 ====
NOTE: You should have no need of this script, if you update your repo regularly.
 
Supply a subversion of 1.23 (for example 42) and the script will download and extract this subversion in your base dir. After execution, you will find a new dir, e.g. named mediawiki-1.23.42 in your basedir containing the downloaded sources. Call [[#get_new_version_going|get_new_version_going]] next.
 
==== get_new_version_going ====
NOTE: You should have no need of this script, if you update your repo regularly.
 
A small script to initialize a new version (update, not upgrade) of the mediawiki software. You need to be in the new versions directory and a symlink named "mediawiki" to your current version should exist in your basedir.
 
==== import_dumps ====
Usage:
* Switch to a dir that contains at least one medaiwiki dump file ending with <code>.xml</code>
* or call with the name of a mediawiki dump file as argument
 
This imports all .xml files in the current directory or the supplies xml file in your mediawiki. Useful to call in your <code>./_opt/init/local_content</code> dir if you want to update your project's content/engine files or even in the <code>./_opt/init/base_content/default</code> dir if you want to update the package's base files
 
More help is available via parameter <code>--help</code>.
 
==== init ====
This is an installation wizard for a mediawiki installation. See [[#Finalize, the easy way|Finalize, the easy way]] for more information.
 
Files belonging to this script are:
* init.config: holds configuration for your initialization
* init.lock: after you initialized your system, this file will be present to warn you, if you accidently execute init a second time
 
More help is available via parameter <code>--help</code>.
 
==== protect_pages ====
Looks for a file named <code>protection.list</code> in the current dir and protects all pages or all pages in categories listed in it.
 
Note: This script uses the url, supplied in your <code>LocalSettings_host.php</code>. To be more specific, it uses the url the helper script [[#url|url]] returns. See there for more information.
 
More help is available via parameter <code>--help</code>.
 
==== tweak_timestamp ====
A crude helper scripts that simply updates all timestamps in a mediawiki dump xml file. This fakes the dump file's last revision dates to be NOW so that each page contained in the dump file will automatically have a new revision showing in its page histories.
 
==== update_content ====
Creates up-to-date versions of your project's dump files, as long as there are *.list files present in _opt/init/local_content. When called with parameter <code>--base</code> it updates the base installation files instead.
 
This script uses the [[#create_dumps|create_dumps]] and should be used to generated updated xmls for your project. It is probably used only on dev systems.
 
More help is available via parameter <code>--help</code>.
 
==== url ====
Returns your project's url. This will be fetched from your <code>LocalSettings_host.php</code> or - if present - from a configfile named <code>url.config</code>. If you didn't run [[#init|init]] and/or you need a different url than that provided in your config, just create a file named <code>url.config</code> and fill it with the hostname you want. Use this as template:
{{code|lang=bash|code=
# this is a configuration script for the instance's url retrival
# as long as this file is present, all scripts will use the url stored here
URL=https://hostname.domain.org
}}


== Apache ==
== Apache ==
Please configure your Apache to use the {{code snippet|lang=bash|code=./mediawiki}} folder as DocumentRoot:
Please configure your Apache to use the {{code snippet|lang=bash|code=./mediawiki}} folder as DocumentRoot:
{{code|apache|
{{code|apache|
   DocumentRoot /var/www/<wikiname>/mediawiki
   DocumentRoot /var/www/<project>/mediawiki
}}
}}


It is also advisable to set these directives:
It is also advisable to set these directives:
{{code|apache|
{{code|apache|
   php_admin_value open_basedir "/var/www/<wikiname>:/usr/share/php/:/usr/bin/:/dev/null"
   php_admin_value open_basedir "/var/www/<project>:/usr/share/php/:/usr/bin/:/dev/null"
   php_admin_value upload_tmp_dir "/var/www/<wikiname>/php_temp/"
   php_admin_value upload_tmp_dir "/var/www/<project>/php_temp/"
   php_admin_value session.save_path "/var/www/<wikiname>/php_temp/"
   php_admin_value session.save_path "/var/www/<project>/php_temp/"
}}
 
of course replace {{code snippet|lang=apache|code=<wikiname>}} with whatever wikiname/directory you chose.
 
If you decided for the luasandbox, you'll have to do some changes to your php configuration. We'll explain [[#lua|below]].
 
== Additional Packages ==
 
=== lua ===
If you opt for the use of a lua sandbox (whiz more performant than the default standalone interpreter), you have to install it. If you can't take advantage of the IMT infrastructure, you have to install and compile the lua-sandbox yourself. See [http://www.mediawiki.org/wiki/Extension:Scribunto#LuaSandbox here] for a how-to. Keep in mind to still make the alterations to the <code>LocalSettings_extensions.php</code> as described [[#LocalSettings_extensions.php|later]].
 
You alse have to add the following line to your <code>php.ini</code> or to <code>/etc/php5/conf.d/</code>:
{{code|apache|code=
extension=luasandbox.so
}}
Some installations have more than one php.ini file. You have to add the line to both. For instance:
{{code|io|code=
/etc/php5/cli/php.ini
/etc/php5/apache2/php.ini
}}
 
=== APC (Alternative PHP Cache) ===
Your wiki platform is configured to take advantage of php opcode caching. You can either install apc (recommended) or uncomment the corresponding line in <code>./_config/LocalSettings.php</code>.
 
To install apc hit
{{code|bash|
apt-get apc
}}
 
As a sample configuration you can use this:
 
{{code|apache|code=
apc.enabled=1
 
; If APC is configured with mmap it only uses 1 shm_segment
apc.shm_segments=1
 
; just large memory example ##
apc.shm_size=200M
 
; PHP file cache 1 hour ##
apc.ttl=3600
 
; User cache 2 hour ##
apc.user_ttl=7200
 
; Garbage collection 1 hour ##
apc.gc_ttl=3600
 
apc.max_file_size=1M
 
; Normally set to 1##
apc.stat=1
 
; TYPO3-Empfehlung
apc.file_update_protection=0
}}
}}
Just save this to <code>/etc/php5/conf.d/apc.ini</code>
Note: When at the imt, configure apc via bcfg2.


=== Graphviz ===
of course replace {{code snippet|lang=apache|code=<project>}} with whatever project/directory you chose.
If you want to use the installed GraphViz extension, you have to get two packages and install them as well. For linux systems use this line:
 
{{code|bash|code=
sudo aptitude install graphviz graphviz-dev
}}


You can find more information about the configuration and installation at http://www.mediawiki.org/wiki/Extension:GraphViz#Common
{{ambox|type=info|text=See [[Project:Software customization]] to enable, disable, or configure additional packages like lua, graphvis, or apc.}}


== Configuration files ==
== Configuration files ==
Here is an overview of how your config files look at this point:
On overview and a detailed description of your configuration files can be found [[Project:Software_overview#Configuration_files|on the software overview page]].
{{code|io|code=
-rw-r--r-- 1 www-data www-data  4445 Dec  3 09:50 LocalSettings_acls.php              // defines default roles, you can use later. also sets some basic permissions
-rw-r--r-- 1 www-data www-data  6845 Nov 16 09:49 LocalSettings_extensions.php.sample  // sample file for extension configuration data
-rw-r--r-- 1 www-data www-data  4804 Nov 12 11:54 LocalSettings_host.php.sample        // sample file for your personal host configuration. you have to edit this!
-rw-r--r-- 1 www-data www-data 10664 Dec  3 09:50 LocalSettings_LDAPAuth.php          // ldap configuration. only needed, if you use ldap auth, of course
-rw-r--r-- 1 www-data www-data  8433 Nov 16 09:49 LocalSettings.php                    // general settings
}}


and here is how it must look like:
You at least have to generate a <code>LocalSettings_host.php</code> file and if you want to start a new or change an existing project, create/adjust <code>LocalSettings_project.php</code>. You might also need a <code>LocalSettings_project_extensions.php</code> (which also can be created from a sample file if need be).
{{code|io|code=
-rw-r--r-- 1 www-data www-data  4445 Dec  3 09:50 LocalSettings_acls.php               // defines default roles, you can use later. also sets some basic permissions
-rw-r--r-- 1 www-data www-data  6762 Nov 12 12:04 LocalSettings_extensions.php        // here you can add, remove, and configure extensions
-rw-r--r-- 1 www-data www-data  6845 Nov 16 09:49 LocalSettings_extensions.php.sample  // sample file for extension configuration data
-rw-r--r-- 1 www-data www-data  4832 Nov 12 12:03 LocalSettings_host.php              // your personal host configuration, ready to use
-rw-r--r-- 1 www-data www-data  4804 Nov 12 11:54 LocalSettings_host.php.sample        // sample file for your personal host configuration. you have to edit this!
-rw-r--r-- 1 www-data www-data 10664 Dec  3 09:50 LocalSettings_LDAPAuth.php          // ldap configuration. only needed, if you use ldap auth, of course
-rw-r--r-- 1 www-data www-data  8433 Nov 16 09:49 LocalSettings.php                    // general settings
}}


So simply copy all *.sample files in there normal pendant. These two "unsamples" are excluded from the git.
We cover the basics that are necessary for an installation here. For a detailed description on customization, please visit [[Project:Software_customization|Software_customization]].
{{ambox|type=content|text=Whenever there is a change to any of these files in the repository after an update, you have to adjust your configuration files manually. So if there is a new extension added to the repo with its own acls, commit changes from <code>LocalSettings_extensions.php.sample</code> to <code>LocalSettings_extensions.php</code>. Watch commit messages or diffs for this to happen.}}
 
=== LocalSettings.php ===
If you don't want to use apc, you have to disable the caching:
 
<syntaxhighlight lang="php" line=1 start="98" highlight="2">
  ## Shared memory settings
  #$wgMainCacheType = CACHE_NONE;
  $wgMainCacheType = CACHE_ACCEL;
  $wgEnableSidebarCache=true;
  $wgMemCachedServers = array();
  ...
</syntaxhighlight>
 
* uncomment line 99
* comment line 100 through 102
 
also, if you don't use LDAP, disable the inclusion of the LDAP config by commenting out line 232:
 
<syntaxhighlight lang="php" line=1 start="221" highlight="12">
  ## include some configfiles
  # all other extensions will be included and configured in an external file
  include_once(__DIR__."/LocalSettings_extensions.php");
 
  # finally the access control lists i.e. user/group permissions
  include_once(__DIR__."/LocalSettings_acls.php");
 
  # include host specific settings
  include_once(__DIR__."/LocalSettings_host.php");
 
  # include and configure extension LDAPAuthentication
  include_once(__DIR__."/LocalSettings_LDAPAuth.php");
  ...
</syntaxhighlight>


=== LocalSettings_host.php ===
=== LocalSettings_host.php ===
As you copied <code>LocalSettings_host.sample.php</code> to <code>LocalSettings_host.php</code> it looks like this:
As you copied <code>LocalSettings_host.sample.php</code> to <code>LocalSettings_host.php</code> it looks like this:
<syntaxhighlight lang="php" line=1>
<syntaxhighlight lang="php" line="1" highlight="43">
<?php
<?php
# ***************************** NOTE *****************************
# ***************************** NOTE *****************************
# It is important that you adjust the following line at the end of LocalSettings.php to match your layout:
# This is a special config file for all host specific settings
#
# like database, sitename, secret key, etc.
# define("toConfigPath", "/var/www/<yourwikiname>/_config");
#
 
# For configurations settings that are valid for your whole
# this is a special config file for all host specific settings like database, etc.
# project, see LocalSettings_project.php
#
# See includes/DefaultSettings.php for all configurable settings
# and their default values, but don't forget to make changes in _this_
# file, not there.
#
# Further documentation for configuration settings may be found at:
# https://www.mediawiki.org/wiki/Manual:Configuration_settings


## Sitespecific information:
# Name of Site (and Project space)
$wgSitename = "YOURSITENAME";
$wgMetaNamespace = "Project";


# Contact adresses
# Protect against web entry
$wgEmergencyContact = "webmaster@domain"; // one of your email accounts
if ( !defined( 'MEDIAWIKI' ) ) {
$wgPasswordSender = "webmaster@domain";  // one of your email accounts
exit;
}


# we store the name of our localhost in this varibale, so we can use it later
$xgNameLocalhost = "yourhostname.domain"; // your fully quallified host name


# Site language code, should be one of the list in ./languages/Names.php
## Maintenance mode
$wgLanguageCode = "en";
###################
# This sets your project in maintenance mode. Can also be set in LocalSettings_maintenance.php
#$wgReadOnly = 'Down for maintenance, access will be restored shortly';


# The relative URL path to the logo. Make sure you change this from the default,
# or else you'll overwrite your logo when you upgrade!
#$wgLogo = "$wgStylePath/common/images/wiki.png";
#$wgLogo = "/img_auth.php/f/f4/MyUploadedLogo.png"; # when using img_auth.pgp (see below)
$wgLogo = "$wgScriptPath/images/common/logo.jpg";  // we recommend storing your wikilog in _images/common


## Caching
# is per default active. you maybe want to disable this on dev or staging systems
#$wgMainCacheType = CACHE_NONE;


## File handling
# To enable image uploads, make sure the 'images' directory
# is writable, then set this to true:
$wgEnableUploads = true;
$wgTmpDirectory = "/var/www/<yourwikiname>/php_temp"; // the php_temp is part of your bundle. if you change this location, please also alter your apache2.conf


# for handling files via img_auth
## Site specific information:
#$wgUploadPath = "$wgScriptPath/img_auth.php";
# Name of Site (and Project space).
# Default for project is found in LocalSettings_project.php; overwrite on project or staging hosts here
#$wgSitename = $wgSitename . " - staging";
#$wgMetaNamespace = "Projekt";


# when using img_auth.php, you can specify a different file directory.
## Host specific settings
# remember: this must be within apache's open_basedir, but not necessary below DOCUMENT_ROOT
# The protocol and server name to use in fully-qualified URLs
#$wgUploadDirectory = '/var/www/<yourwikiname>/_images'
# project default is set in LocalSettings_project.php
#$wgServer = "https://yourhostname.domain";


# default allowed file extensions are: .gif, .jpg, .jpeg, .png, .tar, .zip, .rar, .pdf, .svg
# The relative URL path to the logo. Make sure you change this from the default,
# you can specify more here:
# Default for project is found in LocalSettings_project.php; overwrite in project or staging here
#$wgFileExtensions[] = ".tif"
#$wgLogo = "$wgScriptPath/images/common/logo.jpg";
#$wgFileExtensions[] = ".tiff"




## The protocol and server name to use in fully-qualified URLs
## Contact addresses
$wgServer = "https://".$xgNameLocalhost;           // DO NOT TOUCH
# Default for project is found in LocalSettings_project.php; overwrite in project or staging here
#$wgEmergencyContact = "thatsme@domain"; // one of your email accounts
#$wgPasswordSender = "thatsme@domain";   // one of your email accounts




## Database settings
## some secrets
$wgDBtype = "mysql";
# db password
$wgDBserver = "localhost";
$wgDBpassword = "DBPASSWD";
$wgDBname = "DBNAME";
$wgDBuser = "DBUSER";
$wgDBpassword = "DBPASSWD";


# secret session fallback hash
# Note: $wgSecretKey: [0-9a-z]{64}
$wgSecretKey = "4207ee50e0e84aad131214b2ede66f206ca3b94a00fbecc3b25c62e4e38a96c9";


## some secret keys
# Changing this will log out all existing sessions.
# Note: $wgSecretKey: [0-9a-z]{64}
$wgAuthenticationTokenVersion = "1";
$wgSecretKey = "4207ee50e0e84aad131214b2ede66f206ca3b94a00fbecc3b25c62e4e38a96c9";


# Site upgrade key. Must be set to a string to turn on the
# web installer while LocalSettings.php is in place
# Note: if you want web updates set $wgUpgradeKey to a random string [0-9a-z]{16}
$wgUpgradeKey = false;


## debug
########
# error_reporting(E_ALL);
# ini_set ("display_errors", "1");
# $wgShowExceptionDetails = true;
# $wgReadOnly = 'Down for maintenance, access will be restored shortly';
# $wgDebugToolbar = true;
## $wgShowDebug = true;
# $wgDevelopmentWarnings = false;
## $wgShowSQLErrors = true;
## $wgDebugDumpSql = true;
## $wgShowDBErrorBacktrace = true;
# $wgDebugLogFile = $wgTmpDirectory . "/project-debug.log";
## Lua debug log file is to be configured in LocalSettings_extensions.php


## Namespace configuration
/**
# including new definition of access rights that have to be assigned to these role arrays:
* LDAP Debugging
# $imtDefaultRoleContributor, $imtDefaultRoleCurator, $imtDefaultRoleDevelope, $imtDefaultRoleAdministrator, or $imtDefaultRoleMaintenancebot
*/
#define("NS_META", 3500);
if ( false ) {
#define("NS_META_TALK", 3501);
// @debug
#$wgExtraNamespaces[NS_META] = "Meta";
$LDAPProviderCacheType = CACHE_NONE;
#$wgExtraNamespaces[NS_META_TALK] = "Meta_talk";
#ldap_set_option( null, LDAP_OPT_DEBUG_LEVEL, 7 );
#$wgNamespacesWithSubpages[NS_META] = true;
$wgDebugLogGroups['LDAP'] = __DIR__ . '/../LDAP.log';
#$wgNamespaceProtection[NS_META] = array( 'write_in_NS_META' );
$wgDebugLogGroups['MediaWiki\\Extension\\LDAPProvider\\Client'] = __DIR__ . '/../LDAPClient.log';
#$imtDefaultRoleContributor["write_in_NS_META"] = true;
$wgDebugLogGroups['LDAPGroups'] = __DIR__ . '/../LDAPGroups.log';
#$imtDefaultRoleCurator["write_in_NS_META"] = true;
$wgDebugLogGroups['LDAPAuthorization'] = __DIR__ . '/../LDAPAuth.log';
#$imtDefaultRoleDeveloper["write_in_NS_META"] = true;
// $$wgDebugLogGroups['LDAPUserInfo'] =
#$imtDefaultRoleAdministrator["write_in_NS_META"] = true;
}
 
 
## Access control
# public or not
# by default, content can only be viewed after a successful login
# with this setting, however, your wiki is free to READ for all:
#$wgGroupPermissions['*'] =& $imtDefaultRoleReader;
# if you configured the use of img_auth above, you also have to uncomment this:
#$wgImgAuthPublicTest = false;
 
# access roles: you can assign default roles or use an array with custom rights
# default roles are: $imtDefaultRoleContributor, $imtDefaultRoleCurator, $imtDefaultRoleDevelope, $imtDefaultRoleAdministrator, or $imtDefaultRoleMaintenancebot
# note:
# * 'user' (the group of authenticated user) already has the role contributor
# * 'imt-web' (imt's application managers) already has the role administrator
# * 'imt-mediawiki-maintenance' (ldap bot accounts) already has the role maintenancebot
# also remember: an ldap group used here must have the ldap group attribute 'Wiki Gruppe'
#$wgGroupPermissions['sample group'] =& $imtDefaultRoleAdministrator;
 
# you can restrict login to a list of groups (each of which has its users added to wiki group 'user' automatically)
#$imtGrantAccessRoles = array( 'sample_group' );
 
# you can also deny access for a list of groups
# remember: an ldap group used here also must have the ldap group attribute 'Wiki Gruppe'
#$imtDenyAccessRoles = array( 'blacklist_group' )
?>
</syntaxhighlight>
Your tasks here are:
# Line 11: specify the name of your site
# Line 12: specify the name of your project's namespace. this usually is either "Project" (or your language equivalent) or your project id (e.g. "imtkb")
# Line 15f: email contact addresses
# Line 19: give here your fully qualified host name, e.g. en.wikipedia.org
# Line 22: here you choose your language locale (e.g. en, de, au, ...)
# Line 28: specify the location or your wiki's logo. we recommend putting it in <code>./_images/common</code>
# Line 34: is for enabling (or disabling) file uploads
# Line 35: if you allow fileuploads, specify here the temporary upload directory. we recommend the php_temp folder that came with your installation. If you choose a different folder, be sure to also change your [[#Apache_notes|Apache configuration]] accordingly.
# Line 38,42: This section deals with a secure image wrapper. if you have to use it, configure it here. See [http://www.mediawiki.org/wiki/Manual:Image_Authorization here for further details].
# Line 51: We'll mention it here again: as it says in the comment: DO NOT TOUCH (unless of course you really know what you do)
# Line 55ff: configure your database connection here. Specify database, database user and database user's password here like you [[#MySQL|set it up earlier]].
# Line 64: For security reasons you must personalize <code>$wgSecretKey</code>
{{ambox|type=speedy|text=Please don't take the <code>$wgSecretKey</code> lightly. '''Change it!''' It is a 64 character string containing digits and lower case letters. Use tools like <code>pwgen</code> for better results.}}
# Line 69: Webupdate is disabled by default. If you need this, set <code>$wgUpgradeKey</code> accordingly
# Line 72ff: Here begins the namespace configuration. you can take the dollowing lines as templates and define one or more new namespaces
## Line 75f: specify a unique constant name for a namespace id. The ids must be unique and should not be lower than 3500. Remember to specify a corresponding talk namespace
## Line 77f: Like this you can assign a name to your namespace. Be careful not to pick an existing one
## Line 79: If you want subpages enabled in your namespace,
## Line 80ff:You can restrict write access to your namespace. remember to assign a corespronding permissin to a role/roles
# Line 87ff: Here you have to assign roles to security groups. See [[Project:Customization#Access control|Access control]] for more information.
 
=== LocalSettings_extensions.php ===
This includes and configures all extensions of your platform. You can add and remove extensions here.
 
Note: The first part (that one being about semantic) configures semantic media wiki and dependant extensions. Most of them are installed via composer, therefore you won't find any file inclusions for these extensions here. Please see [[Project:Maintenance#Composer|Maintenance#Composer]] for more information on how to install, remove and upgrade composer dependant extensions.
 
Second part containes the traditionally installed extensions in an alphabetical order. With each extensions comes their basic configuration. However, if they require certain access rights specify them in <code>LocalSettings_acls.php</code>.
 
==== lua ====
This platform needs the [http://www.mediawiki.org/wiki/Extension:Scribunto Scribunto extension] - which gives lua support - to work properly. You can either use the default Lua standalone compiler or a mediawiki optimized lua sandbox. When you are at the university, just install the debian packet php-luasandbox or get the bcfg2 bundle lua. Then modify the <code>LocalSettings_extensions.php</code>. Search for this section:
<syntaxhighlight lang="php" line=1 start="177" highlight="6">
  # Scribunto (hope, this thing works out)
  require_once( "$IP/extensions/Scribunto/Scribunto.php");
  $wgScribuntoUseGeSHi = true;  # adds GeSHi-capabilities to scribunto
  $wgScribuntoUseCodeEditor = true; # lets Scribunto use the CodeEditor
  $wgScribuntoDefaultEngine = 'luastandalone';
  #$wgScribuntoDefaultEngine = 'luasandbox';
  $wgScribuntoEngineConf['luasandbox']['memoryLimit'] = 100 * 1024 * 1024;  // default is 50 * 1024 * 1024
  $wgScribuntoEngineConf['luasandbox']['cpuLimit'] = 10;    // default is 7
</syntaxhighlight>
</syntaxhighlight>
and uncomment the highlighted line.


If you can't take advantage of the IMT infrastructure, you have to install the sandbox yourself. See [http://www.mediawiki.org/wiki/Extension:Scribunto#LuaSandbox here] for a how-to. Keep in mind to still make the alterations to the <code>LocalSettings_extensions.php</code> as described above.
All you really need to do is to create it. What might also be necessary is to configure your hostname, if the one set in <code>LocalSettings_project.php</code> is not the correct one. Please see the highlighted line #44. You can also set database credentials in this file (line #62) if you opt not to use the [[#Finalize, the easy way|init script]], in which case you also should set a new secret session fallback hash (line #66).
 
You alse have to add the following line to your <code>php.ini</code> or to <code>/etc/php5/conf.d/</code>:
{{code|apache|code=
extension=luasandbox.so
}}
Some installations have more than one php.ini file. You have to add the line to both. For instance:
{{code|io|code=
/etc/php5/cli/php.ini
/etc/php5/apache2/php.ini
}}


== Finalize, the easy way ==
== Finalize, the easy way ==
The easy way to finalize your project is to run one of your [[#Available helper scripts|helper scripts]]: '''init'''. This is a wizard to guide you through the last steps of your installation.
The easy way to finalize your project is to run one of your [[Project:Software_overview#Helper_scripts|helper scripts]]: '''init'''. This is a wizard to guide you through the last steps of your installation.


But before you start you should '''customize your init'''. To do this switch to  
But before you start you can '''customize your init'''. To do this switch to  


  ./_opt/scripts
  ./_opt/bin


and edit <code>init.config</code>. It looks like this:
and edit <code>init.config</code>. It looks like this:
Zeile 482: Zeile 168:
# instance language. supported are de, en
# instance language. supported are de, en
LANG=de
LANG=de
# this is your apache user and apache usergroup
APACHERUNSAS=www-data:www-data


# switches for all the optional base packages
# switches for all the optional base packages
OPT_BOILERPLATES=1
OPT_BOILERPLATES=1
OPT_DOCUMENTATION=0
OPT_GADGETS=1
OPT_GADGETS=1
OPT_KERBEROS=1
OPT_KERBEROS=1
Zeile 505: Zeile 189:
* Line 4: select your database collation. This must match your {{code snippet|lnag=php|code=$wgDBTableOptions}} from your MediaWiki configuration. Normally this is ''utf8''
* Line 4: select your database collation. This must match your {{code snippet|lnag=php|code=$wgDBTableOptions}} from your MediaWiki configuration. Normally this is ''utf8''
* Line 7: this is your default language. Supported entries are ''de'' and ''en''
* Line 7: this is your default language. Supported entries are ''de'' and ''en''
* Line 10: when init is finished it runs a chown -R with this as a username/usergroup. if you want to skip the execution of chown, set this to an empty string
* Line 10ff: There are four optional packages you can import. Set the corresponding entry to something different than 1 to disable the package. Note: When your are not using Kerberos, you should comment out the inclusion of LocalSettings_LDAPAuth.php in your [[#LocalSettings.php|LocalSettings.php]].
* Line 13ff: There are three optional packages you can import. set the corresponding entry to something different than 1 to disable the package. Note: When no using Kerberos, you should comment out the inclusion of LocalSettings_LDAPAuth.php in your [[#LocalSettings.php|LocalSettings.php]].
* Line 16: If you want to contribute file uploads and page protections to a local user, set USERNAME accordingly
* Line 18: If you want to contribute file uploads and page protections to a local user, set USERNAME accordingly
* Line 21ff: ''init'' should be able to obtain database information from your LocalSettings_project.php and LocalSettings_host.php directly. However, if you want to make sure, use a different configuration or file structure, you can set this data here manually.
* Line 23: ''init'' should be able to obtain database information from your LocalSettings_host.php directly. However, if you want to make sure, use a different configuration or file structure, you can set this data here manually.


When you are finished customizing your config, you can start the wizard. If you want to play it safe, you can do a dry-run first, no action will be taken. You can do this with the command:
When you are finished customizing your config, you can start the wizard. If you want to play it safe, you can do a dry-run first, no action will be taken. You can do this with the command:
Zeile 593: Zeile 276:
=== Import packages ===
=== Import packages ===
Now that the database is ready, you can start getting the content in. For that matter, we are going to import the bundled pages. You can do this later, even inside your wiki on [[Special:Import]], but we recommend doing it right ahead. So, remember we're still in <code>./mediawiki/maintenance</code>. First run:
Now that the database is ready, you can start getting the content in. For that matter, we are going to import the bundled pages. You can do this later, even inside your wiki on [[Special:Import]], but we recommend doing it right ahead. So, remember we're still in <code>./mediawiki/maintenance</code>. First run:
{{ambox|type=notice|text=For the import you can also use [[Project:Software_overview#import_dumps|the script import_dumps]].}}


{{code|io|
{{code|io|
find ../../_opt/init/base_content/default/ -name \*.xml -exec php importDump.php --no-updates {} \;
find ../../_opt/init/base_content/default/ -name \*.xml -exec php importDump.php --no-updates {} \;
}}
}}
or
{{code|io|
./import_dumps --base;
}}
to import the mandatory packages. After that, you have to choose which optional packages you want installed:
to import the mandatory packages. After that, you have to choose which optional packages you want installed:
* <code>package-boilerplates.xml</code>, which gives you some predefined preloader pages to use with [http://www.mediawiki.org/wiki/Extension:Preloader Extension:Preloader]
* <code>package-boilerplates.xml</code>, which gives you some predefined preloader pages to use with [http://www.mediawiki.org/wiki/Extension:Preloader Extension:Preloader]
* <code>package-documentation.xml</code>, containing these documentation pages. It is recommended to omit them in public wikis
* <code>package-gadgets.xml</code>, a large list of nice and useful gadgets to use with [http://www.mediawiki.org/wiki/Extension:Gadgets Extension:Gadgets]
* <code>package-gadgets.xml</code>, a large list of nice and useful gadgets to use with [http://www.mediawiki.org/wiki/Extension:Gadgets Extension:Gadgets]
* <code>package-kerberos.xml</code>, predefined messages and the login page you need when using kerberos with ldap authentication
* <code>package-kerberos.xml</code>, predefined messages and the login page you need when using kerberos with ldap authentication
Zeile 617: Zeile 308:


=== Import images ===
=== Import images ===
With your platform comes an assortment of 47 pictures, mainly used in interface and message box templates. They are bundled in the extension directory and can easily be imported with a maintenance script So please go ti <code>./mediawiki/maintenance</code> and run:
With your platform comes an assortment of 47 pictures, mainly used in interface and message box templates. They are bundled in the extension directory and can easily be imported with one of the provided scripts in <code>./_opt/bin</code>:
{{code|io|code=
.\import_images --base
}}
or do a manual import with a maintenance script in <code>./mediawiki/maintenance</code>
{{code|io|code=
{{code|io|code=
php importImages.php ../../_opt/init/base_images png gif
php importImages.php ../../_opt/init/base_images png gif
}}
}}
If you want, you can '''specify the wiki user that the upload will be attributed to''' with <code>--user=<username></code>.
If you want, you can '''specify the wiki user that the upload will be attributed to''' with <code>--user=<username></code>.


Zeile 626: Zeile 322:
To finalize the imported content, you have to run a bunch of maintenance scripts. First set an environment variable with:
To finalize the imported content, you have to run a bunch of maintenance scripts. First set an environment variable with:
{{code|lang=bash|code=
{{code|lang=bash|code=
export MW_INSTALL_PATH=/var/www/<wikiname>/mediawiki
export MW_INSTALL_PATH=/var/www/<project>/mediawiki
}}
}}



Aktuelle Version vom 10. März 2022, 10:23 Uhr

This is an installation manual for a MediaWiki platform. For this project, you are probably done with all of this. However, it serves as a guideline for further mediawiki projects. And you can use it as a cheatsheet or checklist to verify your installtion.

What to do

  1. get the files via git git clone --branch <branch> --recursive https://imtdev.uni-paderborn.de/git/mediawiki/mediawiki.git <project>
  2. set up your apache with DocumentRoot /var/www/<project>/mediawiki, adjust php_admin_value open_basedir, upload_tmp_dir, and session.save_path accordingly
  3. in _config create a LocalSettings_host.php from the shipped .sample file. Adjust setting for $wgServer if needed
  4. in _opt/scripts run script init

Get the files

Either use a git repository or get a zip with all the necessary files. Using git at the IMT, the call should look something like this:

git clone --recursive https://imtdev.uni-paderborn.de/git/mediawiki/mediawiki.git <project>

The --recursive is important, otherwise you are missing all the submodules' files.

When using a project branch (like smwcore, hilfe, or imtkb) you can specify it on clone directly with

git clone --branch <branch> --recursive https://imtdev.uni-paderborn.de/git/mediawiki/mediawiki.git <project>

See Project:Software overview for more information about the layout of your wiki software.

Apache

Please configure your Apache to use the ./mediawiki folder as DocumentRoot:

DocumentRoot /var/www/<project>/mediawiki

It is also advisable to set these directives:

php_admin_value open_basedir "/var/www/<project>:/usr/share/php/:/usr/bin/:/dev/null"
  php_admin_value upload_tmp_dir "/var/www/<project>/php_temp/"
  php_admin_value session.save_path "/var/www/<project>/php_temp/"

of course replace <project> with whatever project/directory you chose.

Configuration files

On overview and a detailed description of your configuration files can be found on the software overview page.

You at least have to generate a LocalSettings_host.php file and if you want to start a new or change an existing project, create/adjust LocalSettings_project.php. You might also need a LocalSettings_project_extensions.php (which also can be created from a sample file if need be).

We cover the basics that are necessary for an installation here. For a detailed description on customization, please visit Software_customization.

LocalSettings_host.php

As you copied LocalSettings_host.sample.php to LocalSettings_host.php it looks like this:

<?php
	# ***************************** NOTE *****************************
	# This is a special config file for all host specific settings
	# like database, sitename, secret key, etc.
	#
	# For configurations settings that are valid for your whole
	# project, see LocalSettings_project.php
	#
	# See includes/DefaultSettings.php for all configurable settings
	# and their default values, but don't forget to make changes in _this_
	# file, not there.
	#
	# Further documentation for configuration settings may be found at:
	# https://www.mediawiki.org/wiki/Manual:Configuration_settings


	# Protect against web entry
	if ( !defined( 'MEDIAWIKI' ) ) {
		exit;
	}


	## Maintenance mode
	###################
	# This sets your project in maintenance mode. Can also be set in LocalSettings_maintenance.php
	#$wgReadOnly = 'Down for maintenance, access will be restored shortly';


	## Caching
	# is per default active. you maybe want to disable this on dev or staging systems
	#$wgMainCacheType = CACHE_NONE;


	## Site specific information:
	# Name of Site (and Project space).
	# Default for project is found in LocalSettings_project.php; overwrite on project or staging hosts here
	#$wgSitename = $wgSitename . " - staging";
	#$wgMetaNamespace = "Projekt";

	## Host specific settings
	# The protocol and server name to use in fully-qualified URLs
	# project default is set in LocalSettings_project.php
	#$wgServer = "https://yourhostname.domain";

	# The relative URL path to the logo. Make sure you change this from the default,
	# Default for project is found in LocalSettings_project.php; overwrite in project or staging here
	#$wgLogo = "$wgScriptPath/images/common/logo.jpg";


	## Contact addresses
	# Default for project is found in LocalSettings_project.php; overwrite in project or staging here
	#$wgEmergencyContact = "thatsme@domain"; // one of your email accounts
	#$wgPasswordSender = "thatsme@domain";   // one of your email accounts


	## some secrets
	# db password
	$wgDBpassword = "DBPASSWD";

	# secret session fallback hash
	# Note: $wgSecretKey: [0-9a-z]{64}
	$wgSecretKey = "4207ee50e0e84aad131214b2ede66f206ca3b94a00fbecc3b25c62e4e38a96c9";

	# Changing this will log out all existing sessions.
	$wgAuthenticationTokenVersion = "1";


	## debug
	########
#	error_reporting(E_ALL);
#	ini_set ("display_errors", "1");
#	$wgShowExceptionDetails = true;
#	$wgReadOnly = 'Down for maintenance, access will be restored shortly';
#	$wgDebugToolbar = true;
##	$wgShowDebug = true;
#	$wgDevelopmentWarnings = false;
##	$wgShowSQLErrors = true;
##	$wgDebugDumpSql = true;
##	$wgShowDBErrorBacktrace = true;
#	$wgDebugLogFile = $wgTmpDirectory . "/project-debug.log";
##	Lua debug log file is to be configured in LocalSettings_extensions.php

/**
 * LDAP Debugging
 */
if ( false ) {
	// @debug
	$LDAPProviderCacheType = CACHE_NONE;
	#ldap_set_option( null, LDAP_OPT_DEBUG_LEVEL, 7 );
	$wgDebugLogGroups['LDAP'] = __DIR__ . '/../LDAP.log';
	$wgDebugLogGroups['MediaWiki\\Extension\\LDAPProvider\\Client'] = __DIR__ . '/../LDAPClient.log';
	$wgDebugLogGroups['LDAPGroups'] = __DIR__ . '/../LDAPGroups.log';
	$wgDebugLogGroups['LDAPAuthorization'] = __DIR__ . '/../LDAPAuth.log';
	// $$wgDebugLogGroups['LDAPUserInfo'] =
}

All you really need to do is to create it. What might also be necessary is to configure your hostname, if the one set in LocalSettings_project.php is not the correct one. Please see the highlighted line #44. You can also set database credentials in this file (line #62) if you opt not to use the init script, in which case you also should set a new secret session fallback hash (line #66).

Finalize, the easy way

The easy way to finalize your project is to run one of your helper scripts: init. This is a wizard to guide you through the last steps of your installation.

But before you start you can customize your init. To do this switch to

./_opt/bin

and edit init.config. It looks like this:

# configuration file for script init

# use this database collation. supported are utf8 and bin
COLLATION=utf8

# instance language. supported are de, en
LANG=de

# switches for all the optional base packages
OPT_BOILERPLATES=1
OPT_DOCUMENTATION=0
OPT_GADGETS=1
OPT_KERBEROS=1

# contribute image imports and page protections to this username
USERNAME=

# you can specify database settings here. normally, they are obtained
# from LocalSettings_host.php automatically, though.
# nevertheless, entries specified here must match your configured settings
DBSERVER=
DATABASE=
DBUSER=
DBPASSWORD=
  • Line 4: select your database collation. This must match your $wgDBTableOptions from your MediaWiki configuration. Normally this is utf8
  • Line 7: this is your default language. Supported entries are de and en
  • Line 10ff: There are four optional packages you can import. Set the corresponding entry to something different than 1 to disable the package. Note: When your are not using Kerberos, you should comment out the inclusion of LocalSettings_LDAPAuth.php in your LocalSettings.php.
  • Line 16: If you want to contribute file uploads and page protections to a local user, set USERNAME accordingly
  • Line 21ff: init should be able to obtain database information from your LocalSettings_project.php and LocalSettings_host.php directly. However, if you want to make sure, use a different configuration or file structure, you can set this data here manually.

When you are finished customizing your config, you can start the wizard. If you want to play it safe, you can do a dry-run first, no action will be taken. You can do this with the command:

 ./init --dryrun

If you are sure, just skip the parameter and start the wizard with

 ./init

Please read the printout thoroughly and follow through with the user guided script. When the wizard is done, it will create a lock file to prevent you from running the wizard again. If you - for any reason - need to repeat the init-process, you have to delete the file init.lock.

You can get more help for the script, by executing

 ./init --help

Finalize, the hard way

MySQL

You need a database server. This package assumes you use MySQL and it has a predefined structure for a quick start. If you should choose a different database engine, just do so. The initialization should be comparable. However you have to get the table structure yourself (for instance by running the mediawiki installation wizard).

  1. set up a new database, we recommend naming it the same as your wiki. As collation either choose utf8-general or binary. Binary is the original mediawiki type, utf8 the more modern one (we recommend utf8). If you should opt for binary, please change the collation type in LocalSettings.php to binary.
  2. create a database user (or use an existing one)
  3. assign the necessary rights for your user to the database:
    use `mysql`;
    update `db` set `Select_priv`='Y', `Insert_priv`='Y', `Update_priv`='Y', `Delete_priv`='Y', `Create_priv`='Y', `Drop_priv`='Y', `References_priv`='Y', `Index_priv`='Y', `Alter_priv`='Y', `Create_tmp_table_priv`='Y', `Lock_tables_priv`='Y', `Create_view_priv`='Y', `Show_view_priv`='Y', `Trigger_priv`='Y' where `db`='DATABASENAME' AND `user`='DBUSERNAME';
    
  4. If you use phpmyadmin, please check the following:
    Data Structure Administration
    Yes Select Yes Create No Grant
    Yes Insert Yes Alter Yes Lock Tables
    Yes Update Yes Index Yes References
    Yes Delete Yes Drop  
      Yes Create temporary Table
    Yes Show View
    No Create Routine
    No Alter Routine
    No Execute
    Yes Create View
    No Event
    Yes Trigger
  5. Import the db_init-<collation>.sql located in the folder ./_init. Choose the one corresponding to your database collation you chose earlier:
    mysql -u DBUSERNAME -p DATABASENAME < db_init-utf8.sql
    

Database schema

You have to update the database structure once, to alter the schema for use of all the selected extensions. Switch to ./mediawiki/maintenance and run

php update.php

You should also do this after installing new extensions and after each update.

Import packages

Now that the database is ready, you can start getting the content in. For that matter, we are going to import the bundled pages. You can do this later, even inside your wiki on Special:Import, but we recommend doing it right ahead. So, remember we're still in ./mediawiki/maintenance. First run:

find ../../_opt/init/base_content/default/ -name \*.xml -exec php importDump.php --no-updates {} \;

or

./import_dumps --base;

to import the mandatory packages. After that, you have to choose which optional packages you want installed:

  • package-boilerplates.xml, which gives you some predefined preloader pages to use with Extension:Preloader
  • package-documentation.xml, containing these documentation pages. It is recommended to omit them in public wikis
  • package-gadgets.xml, a large list of nice and useful gadgets to use with Extension:Gadgets
  • package-kerberos.xml, predefined messages and the login page you need when using kerberos with ldap authentication

To install them all, hit

find ../../_opt/init/base_content/optional/ -name \*.xml -exec php importDump.php --no-updates {} \;

otherwise just import the packages you want one by one.

Systemlanguage

Depending on what system language you chose you have to import a different package for systemmessages. You find them in ./_opt/init/base_content/language/package-lang-<langcode>.xml. Please choose the file corresponding to your system language you set earlier.

Finalize with update.php

To let the changes on the system messages take place, you have to run update.php again. Switch back to ./mediawiki/maintenance and execute

php update.php

Import images

With your platform comes an assortment of 47 pictures, mainly used in interface and message box templates. They are bundled in the extension directory and can easily be imported with one of the provided scripts in ./_opt/bin:

.\import_images --base

or do a manual import with a maintenance script in ./mediawiki/maintenance

php importImages.php ../../_opt/init/base_images png gif

If you want, you can specify the wiki user that the upload will be attributed to with --user=<username>.

Run maintenance

To finalize the imported content, you have to run a bunch of maintenance scripts. First set an environment variable with:

export MW_INSTALL_PATH=/var/www/<project>/mediawiki

Start with rebuildall.php to populate the categorylinks, pagelinks, and imagelinks tables and set up the search index. Go to ./mediawiki/maintenance and run:

php rebuildall.php

This could take a minute or two.

Then you could initialize the semantic data (that is, if you're using the semantic extensions). This datastore shoud be empty but nevertheless, lets see it as a dry run since you should do this regularily (or by cron, see Maintenance for more on this). Switch to ./_extensions/SemanticMediaWiki/maintenance and hit:

php rebuildData.php -f -v

If you use the extension Approved Revisions you'll have to approve all imported revisions. Otherwise your wiki will be as empty as a fresh installation. Switch to ./_extensions/ApprovedRevs/maintenance and run

php approveAllPages.php

And finally the biggest chunk. Executing all these maintenance scripts (especially rebuildall.php) has packed up your job queue quite a bit. Before starting to use the wiki, you'll have to run all queued jobs. Switch back to ./mediawiki/maintenance and execute

php runJobs.php

This will take really long! Take a coffee break (You deserve it!) and come back in 10.

Protect all vital pages

Now you can choose to protect all vital pages (i.e. some sample pages and a bunch of articles contained in certain categories). Switch to ./_opt/scripts/ execute

 ./protect_pages

If you want to contribute the proctection to a local username other than "127.0.0.1", you can do this by specifying a username with the parameter --user. For instance:

 ./protect_pages --user ProtecT0r

If you want to fix this, go to ./mediawiki/maintenance/ and edit protect.php. Change:

  public function execute() {
  $userName = $this->getOption( 'u', 'Maintenance script' );
  $reason = $this->getOption( 'r', '' );

  $cascade = $this->hasOption( 'cascade' );

into this:

  public function execute() {
  $userName = $this->getOption( 'user', 'Maintenance script' );
  $reason = $this->getOption( 'reason', '' );

  $cascade = $this->hasOption( 'cascade' );

After you're finished, it is recommended that you run

php rebuildall.php
php runJobs.php

again. :( I know, sucks. But in order to populate the categories, it had to be executed once before.

More information about the script can be obtained by running

 ./protect_pages --help


Clean up

Finally, we have to see to it that the webserver can read (and in some cases) modify alle the necessary files. Please change to your platform's root (not your wiki root), for instance to /var/www/mywiki and run

chown -R apache-user:apache-group *

where apache-user is the local username, your apache runs as and apache-group its local group.

Notes on merging with existing installations

This is a very tricky thing to do. First, please backup your system.

Basically what you have to do is take all content from your old system excluding the pages brought to you by this platform and import them both in a new system. Exporting data from your old system could be done via databasedump, XML page export or brute force.

Database

If you use the database option it could be difficult to exclude the pages from this platform. Easiest way to do this is to delete the corresponding pages in your old system. To do that, there are two ways:

  1. Installing Extension:DeleteBatch and feed it the names of the pages to delete. You can find files containing the necessary pagenames in ./_init/lists/ext_db/package-<packagename>.txt
  2. Use a maintenance script located in ./mediawiki/maintenance together with a prepared text file:
php deleteBatch.php -r "preparing to merge" ../../_init/lists/deletebatch/

Export

Here the trick is to generate a list of all pages used in your wiki. Including all custom namespaces, talk pages, systemmessges, subpages, userpages, etc. If you miss one, it won't be your new installation. For instance you could create that list with Special:AllPages with going through all namespaces. Or you could write a databasequery like:

select concat('NAMESPACE_ID_', page_namespace, ':', page_title) from page;

Dump the result and replace all accurances of 'NAMESPACE_ID_?' with the corresponding namespace name.

When you have that list, remove from it all entries found in the ./_init/lists/package/package-*.list files (or at least those corresponding to the packages you like to import later). Here you need some clever scripting, time or a combination of both (for instance an excel with rules for highlighting double entries).

With that list, you can start exporting pages. Do this either via Special:Export. Make shure you include the page history if you want to maintain it (thus unchecking 'Only latest revision') Important: Exclude the used templates, since we are gonna dump them anyway.

As alternative you can use a maintenance script php dumpBackup.php.--full. for export. Unfortunately, this script omits site-related data (they do not contain user accounts, image metadata, logs, etc), so you have to somehow identify those pages and export them via Special:Export. Also, you have to have your 'undesired' pages remove later from the dump. Finding them in the XML could be more tricky and unreliably that the manual export version.

Brute force

Just import both one after another. Pages that exist in both installations will have their history merged. The newest revision will become the current version. You can, however "cheat" if you edit the dump files and change the timestamps accordingly. For instance by script.

Namespace issues

If you had a namespace called meta defined in your old wiki already contaning pages, make sure these namespace had the id 3500 (and the corresponding talk space 3501). If not, you could either renumber the namespace in this platform or replace all namespace ids in our old wiki's dump. If the latter, note that: - each XML dump has a namespace section up front where you have to replace the id - each page entry in the XML dump has a numeric namespace id - the mysql page table contains the namespace as numeric id Change the ids accordingly.

Helper script

You can find a helper script to tweak xml-output in ./_init/_scripts/:

./tweak_timestamp FILENAME

This script takes the specified xml-file containing a mediawiki xml dump and replaces all timestamp entries with a current timestamp.