From AliceWiki
Jump to: navigation, search


  • MediaWiki will be installed on Linux (Fedora) in /opt/mediawiki directory with Apache web server and MariaDB database server. Suppose you have root access to the server. MediaWiki will be used "pretty URL" Short URL page address. Download latest MediaWiki tarball and unpack to /opt directory.
$ tar -xzf mediawiki-*.tar.gz -C /opt/
$ chown -R root:root /opt/mediawiki-*/
$ ln -s /opt/mediawiki-*/ /opt/mediawiki

$ wget -nc -P /etc/httpd/conf.d/
$ systemctl restart httpd.service
  • You can create your database and user in setup process by running the supplied configuration script (see bellow), but prefer create wiki MariaDB database and user manually (or using phpMyAdmin). It will be more general, useful especially in the future (backup, moving or reinstall wiki). Warning: delete .mysql_history file after running these commands (history store the password).
$ mysql -h localhost -u root
MariaDB [(none)]> CREATE DATABASE my_wiki;
MariaDB [(none)]> CREATE USER 'wikiuser'@'localhost' IDENTIFIED BY 'sql_wiki_passwd';   # change password
MariaDB [(none)]> GRANT ALL PRIVILEGES ON my_wiki.* TO 'wikiuser'@'localhost' WITH GRANT OPTION;

Installation script

Connect to database
Database type MariaDB, MySQL, or compatible $wgDBtype = "mysql";
Database host localhost $wgDBserver = "localhost";
Identify this wiki
 Database name my_wiki $wgDBname = "my_wiki";
 Database table prefix $wgDBprefix = "";
User account for installation
 Database username wikiuser $wgDBuser = "wikiuser";
 Database password sql_wiki_passwd $wgDBpassword = "sql_wiki_passwd";
Database settings
Database account for web access
 Use the same account as for installation
Name of wiki MyWiki $wgSitename = "MyWiki";
Project namespace Same as the wiki name: MyWiki
Administrator account
 Your username WikiAdmin my_wiki.user table (MariaDB)
 Password wiki_admin_passwd my_wiki.user table (MariaDB)
 Email address (optional) my_wiki.user table (MariaDB)
 Share data about this installation
 with MediaWiki developers
(optional) $wgPingback = true;
Ask me more questions Options page
User rights profile Authorized editors only $wgGroupPermissions['*']['createaccount'] = false;
$wgGroupPermissions['*']['edit'] = false;
Copyright and license Creative Commons Attribution-ShareAlike $wgRightsUrl $wgRightsText $wgRightsIcon
Email settings
 Enable outbound email (uncheck) $wgEnableEmail = false;
 Vector (use this skin as default) $wgDefaultSkin = "vector";
wfLoadSkin( 'Vector' );
 ExtensionName (optional) wfLoadExtension( 'ExtensionName' );
Images and file uploads
 Enable file uploads $wgEnableUploads = true;
 Enable Instant Commons (optional) $wgUseInstantCommons = true;
Advanced configuration
 Settings for object caching No caching $wgMainCacheType = CACHE_NONE;
  • Press on continue and you will begin the installation of MediaWiki. Only now MediaWiki installer store settings in LocalSettings.php file and populate my_wiki MariaDB database.
  • Download generated file LocalSettings.php and move this file to the main wiki directory /opt/mediawiki.
$ mv LocalSettings.php /opt/mediawiki
$ chmod 600 /opt/mediawiki/LocalSettings.php   # contains $wgDBpassword
$ chown apache:apache /opt/mediawiki/LocalSettings.php


The LocalSettings.php file provides local configuration settings (based on the DefaultSettings.php file) of a MediaWiki.

$wgServer               = "";
$wgLogo                 = "$wgScriptPath/images/strela_logo.png";
$wgFavicon              = "$wgScriptPath/images/strela_icon.png";
$wgShowExceptionDetails = true;

Short URL

$wgScriptPath  = "/mediawiki";
$wgArticlePath = "/wiki/$1";
$wgUsePathInfo = true;
$ wget


File uploads

Uploaded files will be distributed into sub-directories of $wgUploadDirectory (/opt/mediawiki/images/) based on the first two characters of the md5 hash of the filename ($IP/images/a/ab/foo.jpg). If $wgHashedUploadDirectory is false, all images are uploaded in $wgUploadDirectory itself ($IP/images/foo.jpg)

$ chown -R apache:apache /opt/mediawiki/images/
$ chmod -R 755 /opt/mediawiki/images/
$wgEnableUploads       = true;
$wgFileExtensions[]    = "svg";

$wgAllowExternalImages = true;

MediaWiki supports SVG image rendering automatically be rendered as a PNG file. Direct SVG display is not supported in MediaWiki by default, unless you install NativeSvgHandler extension

User rights

$wgGroupPermissions['*']['createaccount'] = false;   # restrict account creation
$wgGroupPermissions['*']['edit']          = false;   # restrict anonymous editing
$wgEnableEmail                            = true;

New users will still be able to be created, but only by WikiAdmin Special:Userlogin



User-agent: *
Disallow: /mediawiki/
Disallow: /wiki/Special:Search
Disallow: /wiki/Special:Random

Be careful, Disallow: /mediawiki (without '/' at the end) you'll block access to the /mediawiki directory, and search engines will drop your wiki


$ php /opt/mediawiki/maintenance/generateSitemap.php --server= --urlpath= --fspath=/var/www/html/
$ ln -s /var/www/html/sitemap-index-alice_wiki.xml /var/www/html/sitemap-index.xml


Privacy policy and Disclaimers

set the content of this pages (as WikiAdmin) to a single hyphen [-]



$ cd /opt/mediawiki/extensions
$ git clone

Math extension needs dvipng and cancel packages from TeX Live and symbolic links on latex and dvipng in /usr/bin/

$ ln -s /opt/texlive/201*/bin/x86_64-linux/latex /usr/bin/
$ ln -s /opt/texlive/201*/bin/x86_64-linux/dvipng /usr/bin/
$ ln -s /opt/texlive/201*/bin/x86_64-linux/dvips /usr/bin/
$ yum install ocaml
$ cd Math/math
$ make                 # produce texvc executable file
$wgUseMathJax = true;
$wgDefaultUserOptions['math'] = MW_MATH_MATHJAX; // setting MathJax as default rendering option for all users
$ php maintenance/update.php



require_once "$IP/extensions/MathJax/MathJax.php";
$wgParserCacheType = CACHE_NONE;
MathJax_Parser::$do_dollar = false;
MathJax_Parser::$do_dollardollar = false;


$ yum install php-pear-Net-Curl
$ cd /opt/mediawiki/extensions
$ git clone
$wgCollectionFormats = array(
    'rl' => 'PDF',
    'odf' => 'ODT',

see README.txt for instructions


git clone
git clone
git clone
git clone
git clone
require_once "$IP/extensions/Cite/Cite.php";
require_once "$IP/extensions/Collection/Collection.php";
#require_once "$IP/extensions/Math/Math.php";
require_once "$IP/extensions/MathJax/MathJax.php";
require_once "$IP/extensions/ParserFunctions/ParserFunctions.php";
require_once "$IP/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php";
require_once "$IP/extensions/Variables/Variables.php";
require_once "$IP/extensions/GistHub/GistHub.php";
require_once "$IP/extensions/GistIt/GistIt.php";

wget -P /opt/mediawiki/extensions/GistHub/


mysqldump !!!!! Make sure to specify the correct character set or the restore may fail, check LocalSettings.php to find out which character set it is.

zamena Main_Page na svoju !!! !!!!!

analogicky => http://localhost/wiki/MediaWiki:Privacy => dont delete, ostavit prazdne http://localhost/wiki/MediaWiki:About => musi vzdy ostat http://localhost/wiki/MediaWiki:Aboutsite => tu nastavim linku (!!!!ak vyprazdnim obsah, zmizne about) http://localhost/wiki/MediaWiki:Disclaimers AKO dosiahnut nech pise This page was last edited on 14 April 2020, at 03:32 (UTC).  !!! aj UTC !!!


Your username will be adjusted to "Skuska" due to technical restrictions.

Mozno daleke todo nastavit mail server pre wiki:$wgSMTP

dalej 2

Delete the /opt/mediawiki/mw-config/ directory

# Ignore .htaccess files
AllowOverride None

mazat bludy (nejak cez find .httacessss)+ nepotrebne extensions



  • Backup MediaWiki (MySQL database + images + LocalSettings.php + others) script Execute as root user (needed permissions to read LocalSettings.php file)
$ wget



Ensure that your "fresh install" consists of the same version of MediaWiki

  1. Backup Backup the database and MediaWiki files
  2. Install Re-create the database, user and permissions
    • create database username: wikiuser with database password: 'sql_wiki_passwd'
    • create database name: strela_wiki with all privileges for wikiuser
$ mysql -u root -p
MariaDB [(none)]> CREATE DATABASE strela_wiki;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON strela_wiki.* TO 'wikiuser'@'localhost' IDENTIFIED BY 'sql_wiki_passwd';
  1. Move
    1. Modify (created file) / copy (previous wiki settings) file LocalSettings.php
      $ chmod 600 LocalSettings.php; chown apache:apache LocalSettings.php
    2. Import the MediaWiki files (copy all MediaWiki files, images/math, images/thumb, images/tmp)
      $ chown -R apache:apache images/; chmod -R 755 images/
    3. Import the database backup
      $ mysql --user=wikiuser --password strela_wiki < strela_wiki-dump_YYYY-MM-DD.sql
    4. Update the database
      $ php /opt/mediawiki/maintenance/update.php