the awikiserver image is a mediawiki instance, with the visual editor by default everywhere, and ParserFunctions? enabled.

Install, Debian 8

First, install mediawiki.

  • sudo apt-get install mediawiki

Note that you will be asked to set the mysql root password.

Create and populate the mysql database:

  • mysql -u root -p
    • <enter your mysql root password>
    • create database my_wiki;
    • quit
  • mysql -u root -p my_wiki < /usr/share/mediawiki/maintenance/tables.sql
    • <enter your mysql root password>

Create and enable an apache configuration for mediawiki:

  • sudo a2enmod rewrite
  • sudo cp /etc/mediawiki/apache.conf /etc/apache2/sites-available/mediawiki.conf
  • Edit /etc/apache2/sites-available/mediawiki.conf as root. Add the following lines after the Alias example (on the third line of the file), to redirect URLs properly:
    Alias /wiki /var/lib/mediawiki/index.php
    Alias /w /var/lib/mediawiki/
    RewriteEngine On
    RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [L]
  • Edit /etc/apache2/sites-available/000-default.conf as root. Insert the following section inside of the <virtualhost *:80> section, to redirect users from / to your mediawiki install:
            <Directory /var/www/html/>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride None
                    Order allow,deny
                    allow from all
                    # This directive allows us to have apache2's default start page                                                                          
                    # in /apache2-default/, but still have / go to the right place                                                                           
                    RedirectMatch ^/$ /wiki/
  • sudo a2ensite mediawiki to enable the serving of our mediawiki apache configuration.

Finally, create the file /etc/mediawiki/LocalSettings.php as root, with the following contents. Make sure to properly replace the <mysql_password> with the mysql root password you selected earlier.

$wgUseTeX = true;
$wgDBuser = 'root';
$wgDBpassword = '<mysql_password>';

$wgScriptPath = "/w";
$wgArticlePath = "/wiki/$1";

Enable File Uploads

Based on: MediaWiki's Documentation.

As root, insert the following in between the <?php and the ?> tags in /etc/mediawiki/LocalSettings.php :

//Enable file uploads
$wgEnableUploads = true; 

Post Install, FAI CD (old, broken!)

After installation with our FAI CD image, the mysql database still needs to be created and populated.

  • sudo /root/
    • It will ask you for the mysql root password twice.


  • change the shell password for root.
  • change the shell password for demo.
  • change the mysql password for root.
    • update /etc/mediawiki/LocalSettings.php with the new password.
  • regenerate the SSH keys.

Building and installing Mediawiki 1.25.2

First, lets install dependencies for building mediawiki, followed by one dependency that is new to 1.25.

  • sudo apt-get install devscripts dpkg-dev dh-buildinfo ocaml-nox xsltproc docbook-xml docbook-xsl
  • sudo apt-get install php5-curl

Next, lets grab the newest mediawiki, extract it, and prepare to build it.

  • wget
  • tar -xzf mediawiki-1.25.2.tar.gz
  • mv mediawiki-1.25.2.tar.gz mediawiki_1.25.2.orig.tar.gz

Grab the debian/ directory from 1.19, extract it, and patch it to work with 1.25.2.

  • wget
  • xz -d mediawiki_1.19.20+dfsg-2.3.debian.tar.xz
  • wget
  • xz -d mediawiki-debian.1.25.2.diff.xz
  • cd mediawiki-1.25.2
  • tar -xvf ../mediawiki_1.19.20+dfsg-2.3.debian.tar
  • patch -p1 < ../mediawiki-debian.1.25.2.diff

Now, run debuild to create .deb files.

  • debuild

Congratulations! If all has gone well, you now have MediaWiki? .deb files. Change to the previous directory and install them. Note that we're going to remove mediawiki-extensions-base, to avoid a conflict.

  • cd ..
  • sudo apt-get remove mediawiki-extensions-base
  • sudo dpkg -i mediawiki_1.25.2-0.1_all.deb
  • sudo dpkg -i mediawiki-classes_1.25.2-0.1_all.deb

Reset the Database, Debian 8

Next, re-create and re-populate our mysql database, using the tables.sql provided by the mediawiki package:

  • mysql -u root -p
    • <enter your mysql root password>
    • DROP DATABASE my_wiki;
    • CREATE DATABASE my_wiki;
    • quit
  • mysql -u root -p my_wiki < /usr/share/mediawiki/maintenance/tables.sql
    • <enter your mysql root password>

Reset the Database, FAI CD

  • mysql -u root -p
    • DROP DATABASE my_wiki;
    • quit
  • sudo /root/

Enabling the Vector skin

  • as root, add wfLoadSkin( 'Vector'); to /etc/mediawiki/LocalSettings.php, as a new line between the <?php and ?> tags.


trying to overwrite '/var/lib/mediawiki/extensions/InputBox', which is also in package mediawiki-extensions-base 3.7



Universal Language Selector

The Universal Language Selector is a Mediawiki extension required by the visual editor.

To install and enable it:

  • cd /var/lib/mediawiki/extensions
  • sudo git clone
  • As root, add require_once "$IP/extensions/UniversalLanguageSelector/UniversalLanguageSelector.php"; in between the <?php and the ?> tags in /etc/mediawiki/LocalSettings.php .
  • cd ~


Parsoid is a html to mediawiki converter used by the visual editor.

First, install the dependencies, and download parsoid:

  • sudo apt-get install npm nodejs
  • git clone

Next, lets grab a debian/ directory for parsoid, and use that to build a .deb:

  • wget
  • cd parsoid
  • tar -xzf ../parsoid-debian.tar.gz
  • debuild
  • cd ..
  • sudo dpkg -i parsoid_0.4.0_all.deb

Install parsoid's node.js dependencies:

  • cd /usr/lib/parsoid
  • sudo npm install
  • cd ~

Finally, restart apache, and start parsoid:

  • sudo service apache2 restart
  • sudo service parsoid restart


Parsoid's dependencies on node.js are quite fragile! once you start parsoid, look for 'nodejs' processes. if you don't see any:

  • cd ~
  • cd parsoid
  • git pull origin master
  • debuild
  • cd ..
  • sudo dpkg -i parsoid_0.4.0_all.deb
  • cd /usr/lib/parsoid
  • sudo rm -rf node_modules
  • sudo npm install
  • sudo service parsoid restart

Wash. Rinse. Repeat.


  • EATS ALL RAM. Takes up 600 megs of ram to start. If you do not have a gig of ram, turn on your swap file. To create a 1G swapfile in /home/:
    • cd /home
    • sudo dd if=/dev/zero of=swapfile bs=1048576 count=1024
    • sudo chmod 600 swapfile
    • sudo mkswap swapfile
    • sudo swapon swapfile
    • cd ~
  • npm install -- installs dependencies not found in debian. They need audited and packaged.

Installing VisualEditor?

  • cd /var/lib/mediawiki/extensions
  • sudo git clone
  • cd VisualEditor
  • sudo git checkout origin/REL1_25
  • sudo git submodule update --init
  • cd lib/ve
  • sudo git checkout origin/REL1_25
  • Add the following to /etc/mediawiki/LocalSettings.php to enable the Visual Editor:
require_once "$IP/extensions/VisualEditor/VisualEditor.php";

// URL to the Parsoid instance
// MUST NOT end in a slash due to Parsoid bug
$wgVisualEditorParsoidURL = 'http://localhost:8142';


  • As root, add the following to /etc/mediawiki/LocalSettings.php between the <?php and ?> tags:
// Enable the visual editor by default for newly created users.
$wgDefaultUserOptions['visualeditor-enable'] = 1;

// Don't allow users to enable it
// $wgHiddenPrefs[] = 'visualeditor-enable';

// OPTIONAL: Enable VisualEditor's experimental code features
// $wgDefaultUserOptions['visualeditor-enable-experimental'] = 1;

// EXPERIMENTAL: Enable VisualEditor everywhere.
$wgVEdefault = 1;

Other Extensions


  • As root, add the following to /etc/mediawiki/LocalSettings.phpbetween the <?php and ?> tags:
    wfLoadExtension( 'ParserFunctions' );

Running MediaWiki? behind proxies


RPAF is responsible for interpreting the 'X-Forwarded-IP' header for apache. This means that IP addresses show up properly in the access.log, and can be used for access control. It also sets the domain name presented to mediawiki "properly".

  • sudo apt-get install libapache2-mod-rpaf
  • edit /etc/apache2/mods-enabled/rpaf.conf as root, and add the ip of EACH of your proxies to the line that starts with RPAFproxy_ips.
  • edit /etc/apache2/sites-available/000-default.conf as root, and change the RedirectMatch to include your FQDN.
  • edit /etc/mediawiki/LocalSettings.php as root, and add the line $wgServer=preg_replace('/, .*/','', $wgServer);, in order to make MediaWiki? see it's domain properly.


  • edit /etc/mediawiki/LocalSettings.php as root. add the following lines:
    $wgUsePrivateIPs = true;
    $wgSquidServers = array('', '');

Again, just like the above, make sure to list EACH of your proxy servers.


  • as root, edit /etc/mediawiki/parsoid/settings.js, and add the following line inside of the function declaration that is the configuration:
    parsoidConfig.setMwApi( 'localhost', { uri: '', proxy: { uri: 'http://localhost/' } } );
  • Make sure to swap out with the domain name of your wiki.
  • restart parsoid: sudo service parsoid restart


Finally, sudo service apache2 restart to make the above take effect.

Future options$wgActionPaths


Place a user into the bureaucrat group:

sudo php maintenance/createAndPromote.php --force --bureaucrat --sysop demo
Last modified 6 years ago Last modified on 10/09/15 22:44:16