From Schmid.wiki
Jump to: navigation, search

MediaWiki - Gentoo

Prerequisites

Check the following USE flags:

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

Installation

# emerge mediawiki
# ln -s /var/www/localhost/htdocs/mediawiki/ /var/www/schmid.dk/wiki

Configuration

start a browser and browse to http://www.sitename.dk/wiki - 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

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

Manually:

$ 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

Upgrading

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

Test

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 schmid.wiki was started, so I first installed it "the hard way", which was actually really easy.

Prerequisites

mySQL

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
                                                                  later...

LaTeX Support Prerequisites

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

Installation

# wget http://mesh.dl.sourceforge.net/sourceforge/wikipedia/mediawiki-[newest version].tar.gz
# tar -xvzf mediawiki-[newest version].tar.gz
# mv mediawiki-[newest version] /var/www/schmid.dk/wiki        <- 'wiki' is the new URL name for
                                                                   the MediaWiki installation
# cd /var/www/schmid.dk/wiki
# chmod a+w config

LaTeX Support

texvc Bugfix and Compilation

# cd /var/www/schmid.dk/wiki/math

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

# vim render.ml

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

References