How to install MediaWiki on FreeBSD

This article was written for MediaWiki 1.17.0 and FreeBSD 8.2

Pre-Requisites

 * Basic FreeBSD server with configured PHP web application stack. See How to build a FreeBSD server, the following references may also be useful:
 * The FreeBSD Handbook by the FreeBSD Project ("The Handbook"),
 * Bulding a Server with FreeBSD 7 by Bryan Hong ("Hong"),
 * Absolute FreeBSD by Michael Lucas ("Lucas"),

Install Procedure
TODO: MEDIAWIKI INSTALLATION PROCEDURE TO BE COMPLETED


 * Login to the Maestro Server as user maestro
 * Download MediaWiki 1.17.0 from http://www.mediawiki.org/ and extract to /usr/home/maestro/www/mediawiki-1.17.0/


 * Review /usr/local/www/mediawiki-1.17.0/INSTALL


 * Create a MediaWiki Apache configuration file /usr/local/etc/apache22/Includes/mediawiki.conf (read by Apache during start up)

Alias /mediawiki /usr/home/maestro/www/mediawiki-1.17.0/ AcceptPathInfo On  AllowOverride None Order Allow,Deny Allow from all 


 * su to root, set permissions on the MediaWiki directory so it is writable by the Apache server (www user) and restart Apache to read the new Maestro config file

> su -
 * 1) cd /usr/home/maestro/www/
 * 2) chown -R www:www mediawiki-1.17.0/
 * 3) /usr/local/etc/rc.d/apache22 reload


 * Browse to the MediaWiki URL and complete the install procedure (e.g. http://www.dalescott.net/scc-mediawiki/)


 * Most MediaWiki configuration in LocalSettings.php file is done automatically, however some manual editing of the file is still necessary.

$wgSitename        = "SCC MediaWiki"; $wgEmergencyContact = "mnestor@dalescott.net"; $wgPasswordSender = "mnestor@dalescott.net"; $wgEnableUploads      = true; $wgGroupPermissions['*']['edit'] = false; $wgShowIPinHeader = false; $wgGroupPermissions['*']['createaccount'] = false; $wgVerifyMimeType = false; $wgFileExtensions = array( 'pdf', 'png', 'gif', 'jpg', 'jpeg', 'zip', 'odp' ); $wgLogo = "{$wgScriptPath}/logo-sun-02-sun-135x135.png";
 * 1) enable file uploading
 * 1) disable editing and hide user toolbar for anon users
 * 1) restrict account creation to sysops
 * 1) disable mime file type verif and allow upload of files with extensions ZIP, ODP, PDF
 * 2) - mediawiki now warns of potential malicious ZIP before downloading
 * 1) show maestro logo in upper left

Updating
TODO: MEDIAWIKI UPDATE PROCEDURE TO BE COMPLETED


 * 1) Download new version to convenient location
 * 2) Fetch or use Lynx to download gzip tarball from project server (e.g. # lynx http://www.mediawiki.org/download/files)
 * 3) Extract new version to /usr/local/www (e.g. # tar -xzvf /usr/home/maestro/distrib/mediawiki-1.15.3.tar.gz)(extract, zip, verbose, file is...)
 * 4) Copy images/ directory from previous version to new version (e.g. # cp -R)
 * 5) Copy extensions/ directory from previous version to new version (only if required)
 * 6) Copy LocalSettings.php from previous version to new version
 * 7) Copy AdminSettings.sample to AdminSettings.php and edit appropriately
 * 8) Change dir to MediaWiki maintenance (e.g. # cd /usr/local/www/mediawiki-1.15.3/maintenance)
 * 9) Run php upgrade script (e.g. # php upgrade.php)
 * 10) Edit MediaWiki Apache config file so Apache serves new version (e.g. # vi /usr/local/etc/apache22/Includes/mediawiki.conf)
 * 11) Re-start Apache (e.g., # /usr/local/etc/rc.d/apache22 restart)

Stop Apache Dump mediawiki database for backup Backup mediawiki Upgrade mediawiki (expect warnings due to new files) Diff LocalSettings.php against backup and edit as appropriate Run php update script Re-start Apache
 * 1) /usr/local/etc/rc.d/apache22 stop
 * 1) mysqldump --add-drop-table -u mediawiki -p mediawiki > ./mediawiki.bak.sql
 * 1) cp -a mediawiki mediawiki.bak
 * 1) cd /usr/ports
 * 2) portmaster www/mediawiki
 * 1) diff mediawiki/LocalSettings.php mediawiki.bak/LocalSettings.php
 * 1) cd /usr/local/www/mediawiki/maintenance
 * 2) php update.php
 * 1) /usr/local/etc/rc.d/apache22 restart

Additional Notes
casper# cd /usr/ports/www/mediawiki casper# make config ; make install clean * Accept defaults ... Installing for php5-readline-5.3.8 The following line has been added to your /usr/local/etc/php/extensions.ini configuration file to automatically load the installed extension: extension=readline.so ... **** NOTE **** Remember to check /usr/local/www/mediawiki/INSTALL and /usr/local/www/mediawiki/UPGRADE for details ===>  Registering installation for mediawiki-1.17.0_1 ===> Cleaning for php5-readline-5.3.8 ===> Cleaning for mediawiki-1.17.0_1 casper#