MediaWiki

Z WebHosting.FM - Napoveda
Přejít na: navigace, hledání

Introduction

MediaWiki is a wiki engine (a program for creating a collaboratively edited website). It is designed to handle heavy websites containing library-like document collections, and supports user uploads of images/sounds, multilingual content, TOC autogeneration, ISBN links, etc. MediaWiki is a free software wiki package originally written for Wikipedia.

MediaWiki v1.16 has it's own page now.

For more details see: MediaWiki

Recommended settings

  • Memory (MB): 512
  • Swap (MB): 512
  • Hard disk (GB): 8

Appliance specific settings

  • Mysql root password: admin

Please change this for security reason:

  • via command line after the first boot:
mysqladmin -u root -p password yournewpasswordhere

MediaWiki settings

  • Main software packages: Debian Lenny, MediaWiki 1.15, MySQL5, Postfix, Apache2, PHP5

First steps

Start the VM and open a VNC console and install the latest security updates.

apt-get update
apt-get dist-upgrade

Now connect to the MediaWiki web installer http://youripaddress and follow the instructions.

Upgrading from v1.15.1 to v1.15.2

Whilst the DAB Makefile shown in the next section is valid for the latest release (the new version has been backported), an existing install of v1.15.1 can be upgraded to v1.15.2 by just overwriting the changed files alone and possibly tweaking the /usr/share/mediawiki/includes/DefaultSettings.php file. Do not forget to take a backup of your existing install before performing any upgrade. Keep a copy of your said existing DefaultSettings.php file for reference for tweaking it's successor after the upgrade.

cd /usr/share/mediawiki/
wget http://www.sacollege.net/files/appliances/mediawiki-upgrade-1.15.1to2.tar.gz
tar -zxvpf mediawiki-upgrade-1.15.1to2.tar.gz
rm mediawiki-upgrade-1.15.1to2.tar.gz
# The following are for tweaking the DefaultSettings.php file
# cd includes
# nano DefaultSettings.php

Now navigate to http://path-to-wiki/index.php/Special:Version page to verify that your version has been upgraded to v1.5.2.

The differences in the /usr/share/mediawiki/includes/DefaultSettings.php file between the versions are that Lines 36 and 2564 show the latest version and build numbers. Lines 353-354 can have the comment swapped - in my case I would use:

$wgMimeTypeFile= "/etc/mime.types";

In line 1740, my old DefaultSettings file had:

$wgTexvc = '/usr/bin/texvc';

but as I do not use texvc, it did not matter.

Download MediaWiki v1.15.5 | MediaWiki v1.16.0

Upgrading to Mediawiki v1.16.0

If you are upgrading between major releases of MediaWiki, the preferred procedure is as follows:

  • 1.Unpack the new version of MediaWiki into a new directory
  • 2.Prepare that new directory: copy your current LocalSettings.php from the old directory, copy any installed extensions and custom skins (if any).
  • 3.Enable read-only mode in LocalSettings.php of the old directory:
$wgReadOnly = 'Upgrading to MediaWiki 1.16.0';
  • 4.Run the upgrade script in the new directory.
  • 5.Swap the old directory and the new directory.

The DAB Build Files

The Makefile for MediaWiki is as below (the initial spacings are all tabs):



BASEDIR:=$(shell dab basedir)

all: info/init_ok
	dab bootstrap
	dab install debian-backports-keyring
	dab task mysql --password admin
	dab install apache2-mpm-prefork apache2
	dab task php --memlimit 64
	dab install mediawiki mediawiki-extensions
	install -m 0644 mediawiki.conf ${BASEDIR}/etc/mediawiki/apache.conf
	install -m 0644 robots.txt ${BASEDIR}/var/www/robots.txt
	dab exec a2dissite default
	dab finalize

info/init_ok: dab.conf
	dab init
	touch $@

.PHONY: clean
clean:
	dab clean
	rm -f *~

.PHONY: dist-clean
dist-clean:
	dab dist-clean
	rm -f *~

The dab.conf file is as follows:

Suite: lenny
CacheDir: ../cache
Source: http://ftp.debian.org/debian SUITE main contrib
Source: http://security.debian.org SUITE/updates main contrib 
Source: http://www.backports.org/debian lenny-backports main contrib
#Mirror: http://ftp.debian.org/debian => ftp://mirror/debian
Architecture: i386
Name: mediawiki
Version: 1.15.5-1
Depends: mediawiki (= 1:1.15.5-1~bpo50+1)
Section: www
ManageUrl: http://__IPADDRESS__/
Description: MediaWiki
 MediaWiki is a wiki engine (a program for creating a collaboratively
 edited website). It is designed to handle heavy websites containing
 library-like document collections, and supports user uploads of
 images/sounds, multilingual content, TOC autogeneration, ISBN links,
 etc.

The robots.txt file is as follows:

User-agent: *
Disallow: /index.php?diff=
Disallow: /index.php?oldid=
Disallow: /index.php?title=Help
Disallow: /index.php?title=Image
Disallow: /index.php?title=MediaWiki
Disallow: /index.php?title=Special:
Disallow: /index.php?title=Template
Disallow: /skins

The mediawiki.conf file is as follows:

ServerAdmin webmaster@localhost
ServerSignature Off
ServerTokens Prod

<IfModule mpm_prefork_module>
    StartServers 2
    MinSpareServers 1
    MaxSpareServers 2
    MaxClients          50
    MaxRequestsPerChild 100
</IfModule>

DocumentRoot /var/lib/mediawiki/

<Directory />
        Options FollowSymLinks
        AllowOverride None
</Directory>

<Directory /var/lib/mediawiki/>
        Options +FollowSymLinks
        AllowOverride All
        order allow,deny
        allow from all
</Directory>

# some directories must be protected
<Directory /var/lib/mediawiki/config>
        Options -FollowSymLinks
        AllowOverride None
</Directory>
<Directory /var/lib/mediawiki/upload>
        Options -FollowSymLinks
        AllowOverride None
</Directory>

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined

Password Resetting

You can use the maintenance/changePassword.php maintenance script to reset a user's password.

You have to run the script from the command line. In other words, log into the server where your wiki is installed, then open a command prompt. Go to the installation directory, then go to the maintenance subdirectory. Run the following command:

php changePassword.php --user=someuser --password=somepass

Where obviously "somepass" is changed to the password you want to set and "someuser" is changed to the user name as it is listed in the table "user".

Additional Info is at MediaWiki Password Reset Page.

Enable ZIP, DOC, etc upload

In /etc/mediawiki/LocalSettings.php set the variable

$wgEnableUploads       = true;

In the same file, append the following:

$wgFileExtensions[] = 'zip';
$wgFileExtensions[] = 'doc';
$wgFileExtensions[] = 'xls';
$wgFileExtensions[] = 'ppt';
$wgFileExtensions[] = 'pdf';

In /var/lib/mediawiki/includes/DefaultSettings.php (gets overwritten on each update) remove (or comment out) the element 'application/zip' from the $wgMimeTypeBlacklist array.

Now we can upload these extensions as well as the default graphic format extensions!

Documentation and HowTo´s about MediaWiki

MediaWiki | Debian MediaWiki Installation