from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to navigation Jump to search


computing: software: web: MediaWiki: installation


MediaWiki installation is actually surprisingly simple, if you are familiar with basic web site configuration and know how to access your MySQL server. Most of the work in setting up a wiki is creating the skeleton content (filling in all the various pages linked to by the default navbox, links at the bottom, etc.; there should be an article listing all these at some point, because a few of them only show up when you do certain operations), though creating the logo can also take time.


The following steps were noted while installing MediaWiki version 1.4, and later versions have been similar.

  1. Download the latest version from the MediaWiki site. This is usually a .tar.gz file.
  2. Read the INSTALL file; it says what versions of PHP and MySQL are needed.
  3. Unzip the files and upload them to the directory from which the wiki will run. If your whole site is a wiki, then put them directly in the www/ directory; otherwise www/wiki/ or whatever you're calling it. Note: The folders you should be uploading will be "config", "docs", "extensions", etc.; you don't want to upload the outer folder, if any (currently called mediawiki-1.4.5), or else that will become part of the wiki's URL. Wherever the outermost index.php file goes, that will be the "home" URL of your wiki.
  4. Make sure your web server is set up to execute .php files; edit the .htaccess file if needed.
  5. Temporarily make the config folder writable by the web server – "chmod a+w config" should work, or use your FTP browser.
  6. At this point, you can either give the wiki setup script root access to your MySQL server (it will use the username "root", so if your MySQL root user is something different, you will need to create a user named "root" with permissions to create databases and tables), to add a database and user as needed, or you can create the database and user yourself. (Note that this is a username for the wiki software to use, not a human user.)
  7. Browse (with a web browser) to your intended homepage for the wiki – e.g.
    • This will show you a link to the setup script. Click on that link and fill in the fields. If things seem to be missing, or if the script complains about missing files, re-upload the wiki files; I've had problems with uploads mysteriously leaving things out.
  8. Move the config/localSettings.php file into the wiki's home directory -- the installation will tell you to do this, and it will also tell you to click on the link to get to your wiki's home page (which should now be working).
  9. Once the wiki's main page is up and running, delete the config/ directory. (You can always copy it over again, and anyway it won't run unless you start over from scratch.)

And that should be it.


This process has never once gone 100% smoothly for me, but the worst problems took took at most 2-3 hours to fix. More recent installations have taken well under an hour, and typical issues are trivial.

Possible Problems

  • Setup script complains about register_globals being set for PHP
    • if you have root access to the server, you can turn this off by editing php.ini. Otherwise, you can put the following line in .htaccess in your web root:
php_flag register_globals 0

For a little extra safety, add the following lines as well:

<Files ".ht*">
deny from all

That prevents anyone from accessing your .htaccess file via a web browser.

  • Contents look fine, but looks ugly (no logo, external links are followed by the URL in parentheses)
    • make sure .htaccess file is set to deliver .css files as 'text/css': "AddType text/css .css" If adding this line doesn't seem to have any effect, be sure to try clearing your cache or force-reloading the page (shift-reload).


Some customizing you might want to do:


  • chmod 660 LocalSettings.php -- it has the database password in it. (To make sure you can still edit it, add yourself to the owner group.)
  • Note: all changes to LocalSettings.php should be made after this line:
require_once( "includes/DefaultSettings.php" );
  • Allow only logged-in users to edit
  • Prevent uploaded (possibly malicious) scripts from being run
    • Put an .htaccess file in the images/ folder containing this line, plus any other file-extensions which might otherwise be executable:
      AddType text/plain .html .htm .shtml .php .phtml


  • Customize an existing skin
  • Create one or more new skins: to create a new skin called NewSkin based on the Monobook skin
    • copy MonoBook.php to NewSkin.php
    • copy the monobook folder to newskin
    • edit NewSkin.php and change the following two lines:
original (MonoBook) new (NewSkin)
$this->skinname  = 'monobook';
$this->stylename = 'monobook';
$this->template  = 'MonoBookTemplate';
$this->skinname  = 'newskin';
$this->stylename = 'newskin';
$this->template  = 'NewSkinTemplate';
  • in NewSkin.php, modify the line "class MonoBookTemplate extends QuickTemplate {" by changing "MonoBookTemplate" to a new name, e.g. "NewSkinTemplate" (this change and the "this->template" change are necessary in order for login after an explicit logout to work properly)
  • The main CSS code is in newskin/main.css; most simple style changes can be made there. More advanced customization is covered here, here, and probably other places.
  • Make a different (or new) skin the default
    • In localSettings.php, change the value of $wgDefaultSkin to the lowercase name of the target skin (e.g. "newskin")
  • Modify the contents of the navigation bar (on the left in monobook)
    • This is actually very easy, even under v1.4 (it's even easier in v1.5); see customizing

Edit History

  • 2005-10-13 Post-import cleanup & some notes about v1.5
  • 2005-06-11 Created "Steps" and "Likely Customizations" from notes made while installing MediaWiki versions 1.4.1, 1.4.4, and 1.4.5 (4 different installs).