//mediawiki installation with Math extension configured to MW_MATH_LATEXML/MW_MATH_MATHML - Ubuntu 14.04 (commands only)
=== 1. Install and Configure Apache ===
sudo apt-get update
sudo apt-get install apache2 apache2-utils
sudo gedit /etc/apache2/mods-enabled/dir.conf
change;
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
to;
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
sudo service apache2 restart
=== 2. Install MySQL Server ===
sudo apt-get install mysql-server
enter the mysql server root password when prompted (yourMySQLrootPassword)
=== 3. Install and Configure PHP5 ===
sudo apt-get install php5 php5-mysql php-pear php5-gd php5-mcrypt php5-curl
sudo touch /var/www/html/phpinfo.php
sudo gedit /var/www/html/phpinfo.php
Add the following;
firefox - http://localhost/phpinfo.php (verify php support)
sudo touch /var/www/html/phpmysql.php
sudo gedit /var/www/html/phpmysql.php
Add the following;
firefox - http://localhost/phpmysql.php (verify connection to MySQL server)
=== 4. Manual mediawiki installation preliminary operations ===
delete the mysql wiki database;
mysql -u root -p
SHOW databases;
drop database wikiDatabaseName;
restart computer (required because of http://www.mediawiki.org/wiki/Thread:Project:Support_desk/blank_page_while_installing)
sudo chown yourusername /var/www/html (required to be able to write to the web folders)
=== 5. Install latexml MathML prerequisites (required for local latexml server) ===
Install LatexML (http://www.mediawiki.org/wiki/Extension:Math#LaTeXML / http://www.formulasearchengine.com/node/3)
sudo apt-get install libarchive-zip-perl libfile-which-perl libimage-size-perl libio-string-perl libjson-xs-perl libwww-perl libparse-recdescent-perl liburi-perl libxml2 libxml-libxml-perl libxslt1.1 libxml-libxslt-perl texlive imagemagick perlmagick make
download LaTeXML-Plugin-ltxpsgi-master.zip from https://github.com/dginev/LaTeXML-Plugin-ltxpsgi
download LaTeXML-master.zip from https://github.com/brucemiller/LaTeXML
unzip LaTeXML-master.zip (extract the archive somewhere)
unzip LaTeXML-Plugin-ltxpsgi-master.zip (extract the archive somewhere)
cd LaTeXML-master
perl Makefile.PL
make
sudo make install
cd /home/LaTeXML
sudo apt-get install libplack-perl libapache2-mod-perl2 apache2
cd LaTeXML-Plugin-ltxpsgi-master
perl Makefile.PL
make
sudo make install
cd /etc/apache2/sites-available/
sudo nedit latexml.conf (and paste the contents of my latexml config file which I have given below:)
Listen 8888
ServerName localhost
PerlOptions +Parent
$ENV{PLACK_ENV} = 'production';
SetHandler perl-script
PerlHandler Plack::Handler::Apache2
PerlSetVar psgi_app /usr/local/bin/ltxpsgi
ErrorLog /var/log/apache2/latexml.error.log
LogLevel warn
CustomLog /var/log/apache2/latexml.access.log combined
sudo a2ensite latexml
[service apache2 reload]
sudo apache2ctl restart
sudo apt-get install curl
test you can use the following request generated by mediawiki while \sin x^2 is converted:
curl -d 'format=xhtml&whatsin=math&whatsout=math&pmml&cmml&nodefaultresources&preload=LaTeX.pool&preload=article.cls&preload=amsmath.sty&preload=amsthm.sty&preload=amstext.sty&preload=amssymb.sty&preload=eucal.sty&preload=%5Bdvipsnames%5Dxcolor.sty&preload=url.sty&preload=hyperref.sty&preload=%5Bids%5Dlatexml.sty&preload=texvc&tex=literal:%5Csin+x%5E2' localhost:8888 > test.html
replace \\n with \n
replace \ with
test.html should contain a log file with XML output at the end.
=== 6. Manual mediawiki installation (without using apt-get): ===
download mediawiki archive (e.g. http://releases.wikimedia.org/mediawiki/1.23/mediawiki-1.23.2.tar.gz or mediawiki-latest.tar.gz)
tar xvf mediawiki-xxx.tar.gz (extract the archive somewhere)
download Math extension (e.g. Math-REL1_23-d0e998f.tar.gz or Math-master-3a30349.tar.gz)
tar xvf Math-xxx.tar.gz (extract Math folder to mediawiki-1.23.2/extensions)
cp -rf mediawiki-xxx /var/www/html
if necessary (if using an alpha build) download and install a mediawiki skin:
download Vector-refs_heads_master.tar.gz from https://www.mediawiki.org/wiki/Skin:Vector)
tar xvf Vector-refs_heads_master.tar.gz
mv Vector-refs_heads_maste Vector (rename folder to 'Vector')
cp -rf Vector /var/www/html/mediawiki-xxx/skins
firefox: http://localhost/mediawiki-xxx/index.php
* setup wiki
* ...
* Use default settings
* MySQL host: localhost
* MySQL databasename: my_wiki
* MySQL username: root
* MySQL password: ...
* ...
* Name of Wiki: ...
* Project namespace: Same as the wiki name
* your username: ...
* password: ...
* ...
* enable image uploads (this is required for the Math extension to work - to prevent a bug that stops the default PNG generated formulae from being displayed)
* select 'Math' extension
If installation was unsuccessful ("Creating tables for enabled extensions..." throws the following error and never ends) then repeat previous step (reinstall mediawiki by going to firefox: http://localhost/mediawiki-xxx/index.php)
Internal error - testwiki
[9fff98af] /mediawiki-xxx/mw-config/index.php?page=Install Exception from line 182 of /var/www/html/mediawiki-xxx/includes/Hooks.php: Invalid callback in hooks for LoadExtensionSchemaUpdates
Backtrace:
#0 /var/www/html/mediawiki-xxx/includes/GlobalFunctions.php(3975): Hooks::run(string, array, NULL)
#1 /var/www/html/mediawiki-xxx/includes/installer/DatabaseUpdater.php(117): wfRunHooks(string, array)
#2 /var/www/html/mediawiki-xxx/includes/installer/DatabaseUpdater.php(171): DatabaseUpdater->__construct(DatabaseMysqli, boolean, NULL)
#3 /var/www/html/mediawiki-xxx/includes/installer/DatabaseInstaller.php(214): DatabaseUpdater::newForDB(DatabaseMysqli)
#4 [internal function]: DatabaseInstaller->createExtensionTables(MysqlInstaller)
#5 /var/www/html/mediawiki-xxx/includes/installer/Installer.php(1578): call_user_func(array, MysqlInstaller)
#6 /var/www/html/mediawiki-xxx/includes/installer/WebInstallerPage.php(1418): Installer->performInstallation(array, array)
#7 /var/www/html/mediawiki-xxx/includes/installer/WebInstaller.php(280): WebInstallerInstall->execute()
#8 /var/www/html/mediawiki-xxx/mw-config/index.php(79): WebInstaller->execute(array)
#9 /var/www/html/mediawiki-xxx/mw-config/index.php(38): wfInstallerMain()
#10 {main}
download and copy LocalSettings.php to /var/www/html/mediawiki-xxx/
update mediawiki (to prevent an error "A database query error has occurred. This may indicate a bug in the software")
cd /var/www/html/mediawiki-xxx/maintenance
php update.php --quick
=== 7. Install Math Extension ===
1. create image folders
cd /var/www/html/mediawiki-xxx/images
mkdir math
mkdir tmp
sudo chown -R www-data:www-data *
2. compile texvc
Note texvc must be compiled for the Math extension to work;
install Math extension dependencies (e.g. sudo apt-get install build-essential dvipng ocaml texlive-fonts-recommended texlive-lang-greek texlive-latex-recommended)
cd /var/www/html/mediawiki-xxx/extensions/Math/math
make
./texvc /home/yourusername/temp /home/yourusername/temp "y=x+2" iso-8859-1 "rgb 1.0 1.0 1.0" [to test texvc is working]
3. compile texvccheck
Note texvccheck must be compiled for the Math extension MW_MATH_LATEXML and MW_MATH_MATHML options to work (else "$wgMathDisableTexFilter = true;" must be set in LocalSettings.php).
cd /var/www/html/mediawiki-xxx/extensions/Math/texvccheck
make
4. enter the wiki and verify that math png files are being generated;
firefox: http://localhost/mediawiki-xxx
create the following new wiki edit; ""
=== 8. Configure latexml MathML ===
1. configure LocalSettings.php for MW_MATH_LATEXML/MW_MATH_MATHML
gedit /var/www/html/mediawiki-xxx/LocalSettings.php
add the following to LocalSettings.php (after require_once "$IP/extensions/Math/Math.php");
$wgMathValidModes = array( MW_MATH_PNG, MW_MATH_SOURCE, MW_MATH_LATEXML, MW_MATH_MATHML, MW_MATH_MATHJAX);
$wgDefaultUserOptions['math'] = MW_MATH_LATEXML;
$wgLaTeXMLUrl = 'localhost'; //required for local latexml server
2. update mediawiki (to prevent an error "A database query error has occurred. This may indicate a bug in the software")
cd /var/www/html/mediawiki-xxx/maintenance
php update.php --quick
3. enter the wiki and verify that math MathML code is being generated;
firefox: http://localhost/mediawiki-xxx
create the following new wiki edit; ""