Installing Math Extension on MediaWiki (Scientific Linux 6)

First of all, you should have installed EPEL repository. Although not installed natively with SL, it is usually deployed soon after installation — and it’s really handy.

Also, I believe you have deployed some kind of web server environment (e.g. LAMP) as well as MediaWiki.

Keep an eye on any error prompt and let’s start.

  1. Install tetex

    Although you cannot find it with yum search, you can still install it with yum.

    sudo yum -y install tetex

    It actually installs some texlive packages.

  2. Install dvipng

    sudo yum -y install dvipng
  3. Install compilation environment

    I’ll choose gcc, but feel free to use any other environment you like.

    sudo yum -y install gcc
  4. Install OCaml

    sudo yum -y install ocaml
  5. Install Git

    sudo yum -y install git
  6. Get Math extension.

    You should switch to the extension directory of your wiki.

    cd /YOUR-PATH-TO-MEDIAWIKI/extensions
    git clone
  7. Compile texvc

    The source code of texvc is actually included in Math extension.

    cd /YOUR-PATH-TO-MEDIAWIKI/extensions/Math/math
  8. Test texvc

    texvc needs a temporary directory (e.g. /tmp) and a directory for output (e.g. your home dir)

    ./texvc /tmp ~ "y=x+2"

    Now you should find a file like daa63ef966cc412541190bc8794731de.png in your home dir.

  9. Activate Math extension

    Add the following line to LocalSettings.php.

  10. Update database

    php /YOUR-PATH-TO-MEDIAWIKI/maintenance/update.php

    This creates xx_math table in your database.

  11. Modify upload directory permission

    The upload directory should be writable to your web-server user.

    sudo chown -R apache:apache /YOUR-PATH-TO-MEDIAWIKI/images

    You may add following lines in virtual host config file to prevent the directory to be listed.

    <Directory /YOUR-PATH-TO-MEDIAWIKI/images>
        Options -Indexes
  12. Test Math extension

    Write to your sandbox wiki page and you should get a pretty equation.

    <math>x_{1,2} = \frac{-b \pm \sqrt{b^2-4ac}}{2a}</math>

For more information, please refer to official Math extension page on MediaWiki.

BTW, I’m still struggling with CJK support. Installing cjkuni-* from yum repos doesn’t seem to help.

Leave a Comment

Your email address will not be published. Required fields are marked *