Installing MediaWiki

   Installing MediaWiki

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

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
 * 1) Uncompress via Control Panel (cPanel) or command line.
 * tar xzf mediawiki-1.11.0.tar.gz
 * 1) Change the permission on the   folder to 777 (world read/write).
 * chmod 777 config — chmod a+w config
 * 1) Change the permission on the   folder to 755 for uploads to be enabled.
 * chmod 755 images — chmod a+w config
 * 1) Use your Control Panel to create a database. Make a note of DB username and DB password.
 * 2) Point your browser to the wiki directory and run the installation script then click the Install! button.
 * 3) 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.
 * 4) Move the file   from the   folder to the base folder.
 * mv config/LocalSettings.php.
 * 1) Change the Permissions for   to 600.
 * chmod 600 LocalSettings.php
 * 1) Delete the   folder.
 * 2) In most cases the Wiki is now ready to go. For Pickaweb installation you need to do more, so see below...

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 :  SecFilterEngine Off SecFilterScanPOST Off 

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:


 * Directory of your new Mediawiki installation:

Mac OSX Web Server Base Directories

 * Directory of your current Mediawiki installation:


 * Directory of your new Mediawiki installation:

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

Unix Commands

 * = link (we are using the -s option, which creates a "symbolic link", like a shortcut in Windows)
 * = everything
 * = copy a file or directory
 * = make a new directory
 * = remove a file
 * or  = change directory, or, change the working directory
 * = list the files/directories, i.e. ls -la
 * = 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:
 * 4) Create the new base directory for the new wiki:
 * 5) * or
 * 6) Change to the new base directory:
 * 7) Create an   sub-directory (this directory will contain image files uploaded to the new wiki):
 * 8) * or
 * 9) Create a   sub-directory (Mediawiki will create your new LocalSettings.php here):
 * 10) * or
 * 11) Make the config directory writable:
 * 12) * or
 * 1) Create a   sub-directory (Mediawiki will create your new LocalSettings.php here):
 * 2) * or
 * 3) Make the config directory writable:
 * 4) * or
 * 1) * or
 * 1) * or

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:
 * 2) Then, remove LocalSettings.php from being linked in:
 * 3) Change to the new config directory:
 * 4) * or
 * 5) Link in the configuration script file that will set up the wiki:
 * 1) * or
 * 2) Link in the configuration script file that will set up the wiki:
 * 1) Link in the configuration script file that will set up the wiki:

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) * http://www.yoursite.com/new_wiki/index.php
 * 3) Ensure you set a Database Table Prefix different from the original:
 * 4) * 1st installation —
 * 5) * 2nd installation —
 * 6) 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   from the   directory that is below your new base directory up one level to your new wiki's base directory. Here's how:
 * 7) Make sure you are in the new wiki’s base directory:
 * 8) Move the file:
 * 9) * or
 * 10) Optionally, you may remove the config directory that is below your new base directory:
 * 11) 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.
 * 1) Optionally, you may remove the config directory that is below your new base directory:
 * 2) 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.
 * 1) 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

 * mediawiki.org Manual: Wiki family — good starting point.
 * steverumberg.com WikiHelp — Steve Rumber's excellent step-by-step guide to setting up Wiki Family.
 * Putty — free telnet / ssh client.
 * OSX Unix Commands

Moving MediaWiki to a New Server

 * See mediawiki.org: Manual Moving a Wiki — guide to moving to a new server.
 * See mediawiki.org Manual: Backing Up a Wiki — saving the database.
 * See also How to move a wiki to another server — good guide from thealbanyprojectwiki.com.
 * See also MW Tools — web-based script you can use to backup your database, or use the backup files to recover the database. Just download the script and install, but remember to password protect the directory or all your data can be stolen!

Lock the Database
The database must be locked to prevent updates during the migration. $wgReadOnly=" Changes to this site are temporarily disabled. We are currently upgrading the Exponent Docs software. Editing should be restored within a few hours. ";
 * 1) Open.
 * 2) Add/Uncomment the   line to make the wiki read only.
 * 3) Lock Database for Edits during Upgrade

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


 * See MediaWiki.org: Backing Up a Wiki or JRandomHacker: MediaWiki Tricks & Tips

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:
 * 4) * AdminSettings.php
 * 5) * LocalSettings.php
 * 6) * /images/ (folder)
 * 7) * /extensions/ (folder)

Run the Upgrade script

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