Jump to: navigation, search

MediaWiki - Gentoo


Check the following USE flags:

imagemagick math tetex vhosts
             |_ is actually needed to display math in MediaWiki


# emerge mediawiki
# ln -s /var/www/localhost/htdocs/mediawiki/ /var/www/


start a browser and browse to - select to set up the Wiki

Site name               : SchmidWiki
Contact e-mail          : [my email address]
Sysop account name      : schmid
Password / Again        : [my password]
MySQL server            : servitor
Database name           : wikidb
DB username             : wikiuser
DB password / Again     : [wikiuser password]
# mv config/LocalSettings.php .
# vim LocalSettings.php
$wgUseTeX           = true;
$wgMathPath         = "{$wgUploadPath}/math";
$wgMathDirectory    = "{$wgUploadDirectory}/math";
$wgTmpDirectory     = "{$wgUploadDirectory}/tmp";
# rm -fr config

Refresh Time Hack

I hate to wait 10 seconds for refresh, when I log in, so I hacked it:

# sed -i -e "s/10;url/0;url/g" /var/www/localhost/htdocs/mediawiki/includes/OutputPage.php

Changing Style

You can change the style by altering the files of the standard monobook style:

mediawiki/stylesheets/monobook/main.css  <- main stylesheet
mediawiki/LocalSettings.php              <- logo ($wgLogo)

Data Storage

  • All the configuration is located in LocalSettings.php, so save it if you are upgrading.
  • All text and user data is stored in the mySQL database.
  • Uploaded images are stored in the images/[character] directory


Backup all dirs but 'math' and 'tmp' from '/var/www/localhost/htdocs/mediawiki/images'. Backup LocalSettings.php.


$ mysqldump -u wikiuser -p wikidb |gzip >/tmp/wiki_backup.gz

In a script:

$ mysqldump -u wikiuser -p[wikiuser password] wikidb |gzip >/tmp/wiki_backup.gz


If you are upgrading MediaWiki from an older version, the old database is automatically converted for the new version without any problems.


And it works:

<math>\int_{-\infty}^{\infty} e^{-x^2}\,dx = \sqrt{\pi}</math>

Euler's identity:

<math>e^{\pi i} + 1 = 0\;</math>

MediaWiki - Manual Installation

The first ebuild of MediaWiki was created in November 2004, one month after was started, so I first installed it "the hard way", which was actually really easy.



First, I checked whether I had mySQL installed (never used it...)

# emerge -p mysql
[ebuild   R   ] dev2004-10-18b/mysql-4.0.20-r1
          |_ yes, it is installed.

Then, I added it to the default runlevel

# rc-update -a mysql default                                   <- add it to the default runlevel
# /usr/bin/mysql_install_db                                    <- configuration
# rc default                                                   <- start it up
# mysqladmin -u root -h servitor password 'new_password'       <- create root user with new password
# mysqladmin -p -h servitor create wikidb
# mysql -u root -p
mysql> use mysql
mysql> update user set Password=PASSWORD('mypassord_here');    <- this is an ugly hack - fix it

LaTeX Support Prerequisites

# emerge dev-lang/ocaml
# emerge imagemagick
# emerge tetex


# wget[newest version].tar.gz
# tar -xvzf mediawiki-[newest version].tar.gz
# mv mediawiki-[newest version] /var/www/        <- 'wiki' is the new URL name for
                                                                   the MediaWiki installation
# cd /var/www/
# chmod a+w config

LaTeX Support

texvc Bugfix and Compilation

# cd /var/www/

It seems that the syntax used for the 'convert' command in the texvc source is wrong for convert 6.1.3:

# vim

Change this:

let cmd_convert finalpath = "convert -quality 100 -density 120 ps:- " ^ finalpath ^ " >/dev/null 2>/dev/null"

To this:

let cmd_convert finalpath = "convert -quality 100 -density 120 - " ^ finalpath ^ " >/dev/null 2>/dev/null"

And compile it:

# make

texvc Configuration

Create and set permissions for math PNG file directory 'math' and temporary directory 'tmp':

# mkdir math tmp
# chown apache:users math tmp
# chmod 744 math tmp