MediaWiki/Installation

Installation
See https://www.mediawiki.org/wiki/Manual:Installation_guide

CentOS 6
Setup Apache, PHP and MySQL: yum install httpd php mysql mysql-server php-mysql php-xml php-intl yum install gd ImageMagick php-gd
 * 1) optional

Install Caching (CentOS 6): yum install php-pecl-apc yum install php-xcache service httpd restart
 * 1) Select APC, XCache or WinCache.
 * 1) or (but not both)
 * 1) or (but not both)
 * 2) install wincache?

Install APC: yum install php-pear php-devel httpd-devel pcre-devel gcc make pecl install apc

Install GD or ImageMagick: yum install ImageMagick

Install git yum install git

Ubuntu
Ubuntu 16 or 18

sudo apt-get update sudo apt-get upgrade sudo apt-get install apache2 mysql-server php php-mysql libapache2-mod-php php-xml php-mbstring sudo apt-get install php-apcu php-intl imagemagick inkscape php-gd php-cli php-curl git

sudo phpenmod mbstring sudo phpenmod xml sudo systemctl restart apache2.service

sudo a2enmod ssl sudo a2enmod rewrite

sudo mysql -u root -p CREATE DATABASE my_wiki; CREATE USER 'new_mysql_user'@'localhost' IDENTIFIED BY 'THISpasswordSHOULDbeCHANGED'; GRANT ALL ON my_wiki.* TO 'new_mysql_user'@'localhost'; quit;

cd /etc/apache2 sudo ln -s /var/log/apache2 logs

Install MediaWiki
MediaWiki Download - http://www.mediawiki.org/wiki/Download

1.32.0
cd /www wget https://releases.wikimedia.org/mediawiki/1.32/mediawiki-1.32.0.tar.gz tar -zvxf mediawiki-1.32.0.tar.gz mv mediawiki-1.32.0 wiki mv mediawiki-1.32.0.tar.gz wiki cd wiki

chown :www-data cache chmod g+w cache

1.31.0
cd /www wget https://releases.wikimedia.org/mediawiki/1.31/mediawiki-1.31.0.tar.gz tar -zvxf mediawiki-1.31.0.tar.gz mv mediawiki-1.31.0 wiki mv mediawiki-1.31.0.tar.gz wiki cd wiki

1.28
MediaWiki 1.28 requires PHP version 5.5.9: cd /www wget http://releases.wikimedia.org/mediawiki/1.28/mediawiki-1.28.2.tar.gz tar -zvxf mediawiki-1.28.2.tar.gz mv mediawiki-1.28.2  wiki mv mediawiki-1.28.2.tar.gz wiki cd wiki

1.24
MediaWiki 1.24 cd /www wget http://releases.wikimedia.org/mediawiki/1.24/mediawiki-1.24.1.tar.gz tar -zvxf mediawiki-1.24.1.tar.gz mv mediawiki-1.24.1 wiki mv mediawiki-1.24.1.tar.gz wiki cd wiki

Configure MediaWiki
Make config folder writable sudo chown apache mw-config sudo chown www-data mw-config
 * 1) chmod a+w config
 * 2) centos:
 * 1) ubuntu:


 * 1) chown www-data cache

Setup apache virtual hosting: /etc/httpd/conf.d/wiki.conf /etc/apache2/sites-enabled/wiki.conf
 * 1) centos:
 * 1) apache:

wiki.conf Basic Apache Setup: NameVirtualHost *:80

 ServerName wiki.example.com DocumentRoot /www/wiki ErrorDocument 404 /index.html ErrorLog logs/wiki-error_log CustomLog logs/wiki-access_log common 

Clean URL Apache setup: NameVirtualHost *:80

 ServerName wiki.example.com DocumentRoot /www/wiki ErrorLog logs/wiki-error_log CustomLog logs/wiki-access_log common ErrorDocument 404 /index.html

# comment out this section until after mw-config step is complete  RewriteEngine On       RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !^favicon.ico$ #RewriteCond %{REQUEST_FILENAME} !^mylogo.png$ #RewriteRule ^(.+)$ /index.php?title=$1 [PT,L,QSA] RewriteRule ^(.*)$ /index.php/$1 [L,QSA]

# Ubuntu: Require all granted  

Clean URL Apache with SSL setup:  ServerName wiki.example.com

# SSL Enabled: SSLEngine on   SSLCertificateFile /etc/wiki.pem SSLCertificateChainFile /etc/wiki.pem

DocumentRoot /www/wiki

ServerAdmin website@example.com ErrorLog logs/wiki-error_log CustomLog logs/wiki-access_log common

# Short URL  RewriteEngine On       RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !^favicon.ico$ #RewriteCond %{REQUEST_FILENAME} !^mylogo.png$ #RewriteRule ^(.+)$ /index.php?title=$1 [PT,L,QSA] RewriteRule ^(.*)$ /index.php/$1 [L,QSA]

# Ubuntu: Require all granted  

 ServerName wiki.example.com Redirect permanent / https://wiki.example.com 

Restart Apache service httpd restart service apache2 restart
 * 1) centos:
 * 1) ubuntu:

Start wizard: http://wiki.example.com/mw-config/index.php

Note: If you just go to http://wiki.example.com/ you will also be directed to the mw-config setup.

Wizard

 * 1) Environmental Checks
 * 2) * Check for issues reported by wizard and fix. (restart apache, refresh config page, rinse and repeat)
 * 3) Database
 * 4) * MySQL database settings (innodb, binary mode)
 * 5) Options
 * 6) * Enable which extensions and skins you wish to use
 * 7) Install
 * 8) * Click to finalize
 * 9) Complete
 * 10) * Instructions for LocalSettings.php

Database (done by wizard): create database wikidb; create database wikidb DEFAULT CHARACTER SET utf8 COLLATE utf8_bin; grant index, create, select, insert, update, delete, alter, lock tables on wikidb.* to 'wikiuser'@'localhost' identified by 'password'; Remove config wizard (for security) mkdir .archive mv mw-config .archive # or rm -rf mw-config

Cleanup: mkdir .archive mv mediawiki-* StartProfiler.sample COPYING CREDITS FAQ HISTORY INSTALL README README.mediawiki RELEASE-NOTES* UPGRADE .archive mv docs maintenance .archive

References:
 * MediaWiki Installation Guide - http://www.mediawiki.org/wiki/Installation

Upgrading
php maintenance/update.php

References:
 * Manual:Upgrading - MediaWiki - https://www.mediawiki.org/wiki/Manual:Upgrading