This is Gentoo's testing wiki. It is a non-operational environment and its textual content is outdated.
Please visit our production wiki at https://wiki.gentoo.org
MediaWiki
From Gentoo Wiki (test)
MediaWiki is a powerful wiki application used by the Gentoo Wiki and the various Wikimedia Project websites (including Wikipedia).
Installation
Prerequisites
- Install PHP. Enable the xmlreader USE flag, because MediaWiki requires it:
root #
echo "dev-lang/php xmlreader" >> /etc/portage/package.use
root #
mysql -u root -p
mysql> CREATE DATABASE IF NOT EXISTS `mediawiki` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`; mysql> CREATE USER 'mediawiki'@'localhost' IDENTIFIED BY 'changeme'; mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `mediawiki`.* TO 'mediawiki'@'localhost' IDENTIFIED BY 'changeme'; mysql> \q
www-apps/mediawiki
USE flags for www-apps/mediawiki The MediaWiki wiki web application (as used on wikipedia.org)
+sqlite
|
Add support for sqlite - embedded sql database |
imagemagick
|
Enable optional support for the ImageMagick or GraphicsMagick image converter |
mysql
|
Add mySQL Database support |
postgres
|
Add support for the postgresql database |
vhosts
|
Add support for installing web-based applications into a virtual-hosting environment |
Install www-apps/mediawiki:
root #
emerge --ask www-apps/mediawiki
Setup
- Copy mediawiki files from /usr/share/webapps/mediawiki/{version}/htdocs to /var/www/localhost/htdocs/mediawiki
- Point your browser at http://127.0.0.1/mediawiki and follow the instructions.
- Page "Welcome to MediaWiki!":
- "Database name" is "mediawiki"
- "Database username" is "mediawiki"
- "Database password" is "changeme" (or what else you have setup)
- Page "Connect to database":
- Database character set" should be "UTF-8"
- Page "Name"
- "Name of wiki" has to be set
- Setup admin user and password
- Page "Complete!"
- Download your LocalSettings.php configuration and move it to /var/www/localhost/htdocs/mediawiki/LocalSettings.php.
- Point your browser at http://127.0.0.1/mediawiki/ to see your installed and configured wiki.
Advanced configuration
- To use a shorter URL make the following modifications:
add this somewhere (does not matter exactly where):
FILE
/var/www/localhost/htdocs/mediawiki/LocalSettings.php
$wgArticlePath = "/wiki/$1"; $wgUsePathInfo = true;
and add this between <Directory> tags:
FILE
/etc/apache2/vhosts.d/default_vhost.include
RewriteEngine On RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/mediawiki/index.php [L]
- By default the landing page in MediaWiki is unlocked for anyone to edit. Login as admin. By the top right of the page is an arrow that points down, click it and the 3rd option down is "protect" to lock down the page.
- Set an avatar for your wiki. Add to the bottom of /var/www/localhost/htdocs/mediawiki/LocalSettings.php:
- FILE
/var/www/localhost/htdocs/mediawiki/LocalSettings.php
$wgLogo = "/mediawiki/wiki.png";