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.
-
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.
-
Install dvipng
sudo yum -y install dvipng
-
Install compilation environment
I’ll choose gcc, but feel free to use any other environment you like.
sudo yum -y install gcc
-
Install OCaml
sudo yum -y install ocaml
-
Install Git
sudo yum -y install git
-
Get Math extension.
You should switch to the extension directory of your wiki.
cd /YOUR-PATH-TO-MEDIAWIKI/extensions git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/Math.git
-
Compile texvc
The source code of texvc is actually included in Math extension.
cd /YOUR-PATH-TO-MEDIAWIKI/extensions/Math/math make
-
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. -
Activate Math extension
Add the following line to
LocalSettings.php
.require_once("$IP/extensions/Math/Math.php");
-
Update database
php /YOUR-PATH-TO-MEDIAWIKI/maintenance/update.php
This creates xx_math table in your database.
-
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 </Directory>
-
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.