Installing MediaWiki
From Fishcakes Wiki
This page contains a guide to Installing MediaWiki on Linux and Mac OSX.
Contents |
Basic MediaWiki Installation
- 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
-
- Uncompress via Control Panel (cPanel) or command line.
-
tar xzf mediawiki-1.11.0.tar.gz
-
- Change the permission on the
/config/folder to 777 (world read/write).-
chmod 777 config — chmod a+w config
-
- Change the permission on the
/images/folder to 755 for uploads to be enabled.-
chmod 755 images — chmod a+w config
-
- Use your Control Panel to create a database. Make a note of DB username and DB password.
- Point your browser to the wiki directory and run the installation script then click the Install! button.
- 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.
- Move the file
LocalSettings.phpfrom theconfigfolder to the base folder.-
mv config/LocalSettings.php .
-
- Change the Permissions for
LocalSettings.phpto 600 ().-
chmod 600 LocalSettings.php
-
- Delete the
configfolder. - In most cases the Wiki is now ready to go. For Pickaweb installation you need to do more, so see below...
See Also
- mediawiki.org Manual: Installation
- wikibooks.org Administrators Handbook
- mediawiki.org Help: Configuration Settings
- lifehacker.com How to Guide — excellent first start guide with Video Tutorial by Gina Trapani.
- mikeswikidev Mediawiki Dev Blog by Mike Baynton.
- AmbitiousLemon How to Install MediaWiki — excellent guide to command line install.
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 -
cdorcwd= 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
- Launch the your Unix Shell application — i.e. Putty or Mac Terminal Application.
- Login to your webs server.
- Change to the Web Server directory:
-
cd /home/your_account_folder/public_html/
-
- Create the new base directory for the new wiki:
-
mkdir new_wiki - or
mkdir /home/your_account_folder/public_html/new_wiki
-
- Change to the new base directory:
-
cwd /home/your_account_folder/public_html/new_wiki
-
- Create an
imagessub-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
-
- Create a
configsub-directory (Mediawiki will create your new LocalSettings.php here):-
mkdir config - or
mkdir /home/your_account_folder/public_html/new_wiki/config
-
- 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.
- 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/*.* .
-
- Then, remove LocalSettings.php from being linked in:
-
rm LocalSettings.php
-
- Change to the new config directory:
-
cd config - or
cd /home/your_account_folder/public_html/new_wiki/config
-
- 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
- Browse to the index.php in the new base directory to start the MediaWiki Installation:
- Ensure you set a Database Table Prefix different from the original:
- 1st installation —
currentwiki_ - 2nd installation —
newwiki_
- 1st installation —
- 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.phpfrom theconfigdirectory that is below your new base directory up one level to your new wiki's base directory. Here's how:- Make sure you are in the new wiki’s base directory:
-
cd /home/your_account_folder/public_html/new_wiki
-
- Make sure you are in the new wiki’s base directory:
- Move the file:
-
mv config/LocalSettings.php . - or
mv /home/your_account_folder/public_html/new_wiki/config/LocalSettings.php .
-
- Optionally, you may remove the config directory that is below your new base directory:
-
rmdir config
-
- 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!
Upgrading MediaWiki
Lock the Database
The database must be locked to prevent updates during the migration.
- Open
LocalSettings.php. - Add/Uncomment the
$wgReadOnlyline 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:
- 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:
- Ensure that the file
AdminSettings.phphas been created and has the correct database user settings. - Login to your web host using PuTTY or similar command line tool.
- Run the command:
cd /yourwiki/maintenance
- Run the command:
php dumpBackup.php --full > /yourwikidata.xml
- You can get a full listing of options with:
php dumpBackup.php
- You can get a full listing of options with:
- 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
- Upload the new MediaWiki software archive to your server.
- To unpack *.tar.gz run:
tar -xzvf [filename]
- Delete/Remove the old files and folders, except for:
- AdminSettings.php
- LocalSettings.php
- /images/ (folder)
- /extensions/ (folder)
Run the Upgrade script
- Login to the site
- Change to the
maintenancefolder. - Run the command:
$ php update.php
MediaWiki Resources
Official MediaWiki Resources
- mediawiki.org — official MediaWiki website.
- mediawiki.org Manual — contents page.
- mediawiki.org Help — contents page.
- mediawiki.org Help: FAQ — good place for quick answers.
- meta.wikimedia.org Help — User Guide
- wikimedia.org Mailing List — sign up for email updates.
Unofficial MediaWiki Resources
- askdrwiki.com Ask Dr Wiki — helpful advice about all things wiki.
- lifehacker.com How to Guide — excellent first start guide with Video Tutorial by Gina Trapani.
- mikeswikidev Mediawiki Dev Blog — by Mike Baynton.
- mwusers.com Media Wiki Users — forum and mailing lists for users and administrators.
- wikibooks.org Administrators Handbook — excellent admin guide.
- wikibooks.org How to Start a Wiki — excellent guide including a list of free and paid Wiki hosts.
- wikieducator.org Wiki Educator — community site with guides for education projects linked with the development of free content.
Media Wiki Tools
- HTML to Wiki Converter for HTML Tables — excellent tool which converts HTML table tags into their wiki equivalents.

