Installing MediaWiki on Windows Server 2012 R2 Core

  • Install Server 2012 R2 Core on a machine or VM
  • Install IIS using powershell
    • Install-WindowsFeature -Name Web-Server
    • iis_install_serv_core
  • Install Microsoft Web Platform Installer (WebPI)
  • Install Media Wiki using webpicmd
    • Change the directory to : C:\Program Files\Microsoft\Web Platform Installer
    • Run the following command to install the MediaWiki application
      • .\webpicmd /Install /Application:MediaWiki
    • Web Pi will ask you several questions (config options, usernames and password etc…) at the end you should see :
    • media_wiki_core_install
  • Test the installation
  • At the next page i encountered a problem, the css didnt load
    • media_wiki_missing_css
  • I opened up the source and clicked the link which should load the css, this returned :
    • Exception encountered, of type "Less_Exception_Parser" [ec4dcf50] /mediawiki/mw-config/index.php?css=1 Less_Exception_Parser from line 447 of C:\inetpub\wwwroot\mediawiki\vendor\oyejorge\less.php\lib\Less\Parser.php: Less.php cache directory isn't writable: C:\Windows\TEMP Backtrace: #0 C:\inetpub\wwwroot\mediawiki\includes\resourceloader\ResourceLoader.php(1620): Less_Parser->SetCacheDir(string) ...
  • MediaWiki is trying to write to “C:\Window\TEMP” but the user context that PHP is running in (via IIS) doesn’t have permission.
    • !!! This is what I did to resolve the issue, its highly not recommended – it would be better to isolate the MediaWiki temp folder somewhere else !!!
      • Get an object representing the permissions of “C:\inetpub\wwwroot\mediawiki” folder
        • $acl_web = get-acl "C:\inetpub\wwwroot\mediawiki"
      • Get an array of just the access rules for *IUSR*
        • $perms = $acl_web.access|?{$_.identityreference -like "*IUSR*"}
      • Get an object representing just the access permissions for the TEMP folder
        • $acl_temp = (get-item "C:\Windows\TEMP").GetAccessControl("Access")
      • Add the access rules from the mediawiki folder to the temp folder acl
        • $perms | %{$acl_temp.AddAccessRule($_)}
      • Set the TEMP folder permissions to the newly created acl object
        • Set-Acl -path "C:\Windows\TEMP" -aclobject $acl_temp
    • I reloaded the wiki page in my browser and the CSS loaded properly
  • “Installing” MediaWiki
    • Choose language options and continue
    • The next page told me that i was ready to install mediawiki.
    • At the next page, i added the same MySQL options as during the WebPI command line install of MediaWiki
    • I left the database settings as default
    • Next add a title and create yourself a user account
    • This page allows you to change the reply address on the emails sent by mediawiki and also select some extensions. I choose just WikiEditor
    • Download your “LocalSettings.php”
    • Now we need to get this LocalSettings.php file to the server and store it in the mediawiki root folder.
      • I am using a virtual machine, so I opened the file and copied the text – then on the vm i opened notepad, pasted the text and saved the file as “C:\inetpub\wwwroot\mediawiki\LocalSettings.php”
  • I went back to the main page and this time it took a little longer to load – but loaded the Wiki correctly (it didn’t try to take me through install again, meaning it had picked up the settings)
  • To fully enable the WikiEditor extension, I had to add some more lines to the LocalSettings.php file more information : https://www.mediawiki.org/wiki/Extension:WikiEditor

Page loading initially was very slow at about 10s per page! This was happening because the database was being access using the hostname – localhost. This brings the ipv6 stack into play, which for some reason slows everything down.

To fix this, change the $wgDBserver variable in LocalSettings.php to 127.0.0.1 to force the use of ipv4

Advertisements