Installing MediaWiki

From Fishcakes Wiki

Jump to: navigation, search
Edit Menu

Image:Icon_Mediawiki_40px.png Installing MediaWiki

This page contains a guide to Installing MediaWiki on Linux and Mac OSX.


Contents

Basic MediaWiki Installation

  1. Get latest version of MediaWiki Download MediaWiki and upload to server.
    curl -O http://download.wikimedia.org/mediawiki/1.11/mediawiki-1.11.0.tar.gz
  2. Uncompress via Control Panel (cPanel) or command line.
    tar xzf mediawiki-1.11.0.tar.gz
  3. Change the permission on the /config/ folder to 777 (world read/write).
    chmod 777 config — chmod a+w config
  4. Change the permission on the /images/ folder to 755 for uploads to be enabled.
    chmod 755 images — chmod a+w config
  5. Use your Control Panel to create a database. Make a note of DB username and DB password.
  6. Point your browser to the wiki directory and run the installation script then click the Install! button.
  7. Fill in the details and then click the Create Database button. Make sure you use a unique table prefix if sharing the database with other Wikis.
  8. Move the file LocalSettings.php from the config folder to the base folder.
    mv config/LocalSettings.php .
  9. Change the Permissions for LocalSettings.php to 600 ().
    chmod 600 LocalSettings.php
  10. Delete the config folder.
  11. In most cases the Wiki is now ready to go. For Pickaweb installation you need to do more, so see below...

See Also

Additional Installation Procedures

406 Not Acceptable Error

406 Not Acceptable
An appropriate representation of the requested resource /index.php could not be found on this server.
Apache/1.3.37 Server at wiki.dansalmon.info Port 80

The problem lies in the Apache Configuration and seems to relate to wGet function.. Just add the following lines to the .htaccess file to disable mod_security:

<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

See Also

Setup a Wiki Family

Notes about how to Setup a MediaWiki Family to run multiple Wiki's from one dataset on a remote web server or on a Mac OSX web server. If installing on a Mac computer, then before you begin see Guide to Using Unix on Mac OSX to learn how to do all the Unix commands on a Mac.

Setup a Wiki Family to run multiple Wikis from one dataset using Symbolic Links (i.e. alias or shortcut).

Preparation

First, Ensure that FollowSymLinks is enabled on your web server. This is active by default on a Mac OSX web server.

Remote Web Server Base Directories

  • Directory of your current Mediawiki installation:
  • /home/your_account_folder/public_html/current_wiki
  • Directory of your new Mediawiki installation:
  • /home/your_account_folder/public_html/new_wiki

Mac OSX Web Server Base Directories

  • Directory of your current Mediawiki installation:
  • /library/webserver/documents/current_wiki
  • Directory of your new Mediawiki installation:
  • /library/webserver/documents/new_wiki

Note: The following example uses the Remote Web server settings.

Unix Commands

  • ln = link (we are using the -s option, which creates a "symbolic link", like a shortcut in Windows)
  • *.* = everything
  • cp = copy a file or directory
  • mkdir = make a new directory
  • rm = remove a file
  • cd or cwd = change directory, or, change the working directory
  • ls = list the files/directories, i.e. ls -la
  • pwd = display the current directory you are in (print working directory)

STEP A – Create Directories for Your New Wiki

  1. Launch the your Unix Shell application — i.e. Putty or Mac Terminal Application.
  2. Login to your webs server.
  3. Change to the Web Server directory:
    • cd /home/your_account_folder/public_html/
  4. Create the new base directory for the new wiki:
    • mkdir new_wiki
    • or mkdir /home/your_account_folder/public_html/new_wiki
  5. Change to the new base directory:
    • cwd /home/your_account_folder/public_html/new_wiki
  6. Create an images sub-directory (this directory will contain image files uploaded to the new wiki):
    • mkdir images
    • or mkdir /home/your_account_folder/public_html/new_wiki/images
  7. Create a config sub-directory (Mediawiki will create your new LocalSettings.php here):
    • mkdir config
    • or mkdir /home/your_account_folder/public_html/new_wiki/config
  8. Make the config directory writable:
    • chmod a+w config
    • or chmod a+w /home/your_account_folder/public_html/new_wiki/config

STEP B – Link the Mediawiki Program Files

The next step is to link your existing wiki program files to the location of your new wiki.

  1. In one easy command, link all the files that are in your current, working base directory to your new base directory:
    • ln -s /home/your_account_folder/public_html/new_wiki/current_wiki/*.* .
  2. Then, remove LocalSettings.php from being linked in:
    • rm LocalSettings.php
  3. Change to the new config directory:
    • cd config
    • or cd /home/your_account_folder/public_html/new_wiki/config
  4. Link in the configuration script file that will set up the wiki:
    • ln -s /home/your_account_folder/public_html/current_wiki/config/index.php .

PROBLEM: In OSX the ls command only links files. Folders must be linked separately. Bugger.

STEP C – Create the Tables in the Database

  1. Browse to the index.php in the new base directory to start the MediaWiki Installation:
  2. Ensure you set a Database Table Prefix different from the original:
    • 1st installation — currentwiki_
    • 2nd installation — newwiki_
  3. Just as when doing a regular install the MediaWiki software, once you have completed the installation of your new wiki you must move the file LocalSettings.php from the config directory that is below your new base directory up one level to your new wiki's base directory. Here's how:
    1. Make sure you are in the new wiki’s base directory:
      • cd /home/your_account_folder/public_html/new_wiki
  4. Move the file:
      • mv config/LocalSettings.php .
      • or mv /home/your_account_folder/public_html/new_wiki/config/LocalSettings.php .
    1. Optionally, you may remove the config directory that is below your new base directory:
      • rmdir config
  5. You’re done! Your software is all set and if you look in your database (i.e. use phpMyAdmin), you should see a separate set of tables for each wiki.

See Also MediaWiki Family Resources


Moving MediaWiki to a New Server

Upgrading MediaWiki

Lock the Database

The database must be locked to prevent updates during the migration.

  1. Open LocalSettings.php.
  2. Add/Uncomment the $wgReadOnly line to make the wiki read only.
# Lock Database for Edits during Upgrade
$wgReadOnly="<p><big><b>Changes to this site are temporarily disabled.</b></big></p><p>We are currently upgrading the <b>Exponent Docs</b> software. Editing should be restored within a few hours.</p>";

Backup the Database

Backup using phpMyAdmin or your Control Panel. If you don't have access to these then you can also use the following (do both to be safe):

MySQL Backup using mysqlDump

To do a full backup of the database, use the mysqldump function:

  1. Run the command:
    mysqldump -u <user name> <database> -p >> <output file>

XML Backup using dumpBackup

To do a partial backup of just your content. /maintenance/dumpBackup.php script:

  1. Ensure that the file AdminSettings.php has been created and has the correct database user settings.
  2. Login to your web host using PuTTY or similar command line tool.
  3. Run the command:
    cd /yourwiki/maintenance
  4. Run the command:
    php dumpBackup.php --full > /yourwikidata.xml
    You can get a full listing of options with:
    php dumpBackup.php
  5. Copy the backup file to your local hard drive or to a backup archive on your server.

Backup the Files

Backup the files and folders with the command:

-tar -cvf /tmp/wikidir.tar wikidir

Upload & Unpack the New Software

  1. Upload the new MediaWiki software archive to your server.
  2. To unpack *.tar.gz run:
    tar -xzvf [filename]
  3. Delete/Remove the old files and folders, except for:
    • AdminSettings.php
    • LocalSettings.php
    • /images/ (folder)
    • /extensions/ (folder)


Run the Upgrade script

  1. Login to the site
  2. Change to the maintenance folder.
  3. Run the command:
    $ php update.php


Image:Icon Resources 20px.png MediaWiki Resources

Official MediaWiki Resources

Unofficial MediaWiki Resources

Media Wiki Tools


Personal tools