MediaWiki

From Eastnet
Jump to navigationJump to search

MediaWiki installation pages and useful links.

This is a fairly old page that really needs merging with the full installation guide on Shonky - That one isn't public yet because it needs some heavy tidying up. I have left this one here for now because there a lot of useful links. The internal installation page is on http://shonky.com/wiki/MediaWiki

Consult the User's Guide for information on using the wiki software.

Getting Started

Useful Documentation Links

Useful Page Links

Notes

Logbook

Michael 14:09, 12 May 2010 (ADT) Done rewrite rules as of: http://www.mediawiki.org/wiki/Manual:Short_URL#Recommended_how-to_guide_.28setup_used_on_Wikipedia.29 (Though not done the robots.txt but I can't be bothered)


Michael 15:45, 13 May 2010 (ADT) Created new Wiki for shonky.com and documented that below.


Michael 10:53, 14 May 2010 (ADT) Moving the root Wiki into http://eastnet.ca/site and only that now. So remove the Apache2/conf.d entry and put that directly into eastnet's config and trim down the rewrite rules in that and in the LocalSettings.

LocalSettings.php
$wgArticlePath = "/site/$1";  # Virtual path. This directory MUST be different from the one used in $wgScriptPath

Eastnet apache conf change:
Alias /site /var/lib/mediawiki/index.php

Eastnet's www directory - .htaccess
Redirect 301 /index.html /site

Michael 18:09, 15 May 2010 (ADT) Updated the bit about needing a local copy of the maintenance scripts for each host.


Howtos

Separate wiki on a different hosted subdomain

Michael 15:34, 13 May 2010 (ADT)

The top level wiki (this one) has the DB details thus:

$wgDBtype           = "mysql";
$wgDBserver         = "localhost";
$wgDBname           = "wikidb";
$wgDBuser           = "USER";
$wgDBpassword       = "PASS";
# MySQL specific settings
$wgDBprefix         = "mediawiki_";

The path to the existing wiki is effectively /var/lib/mediawiki and is defined in /etc/apache2/conf.d/mediawiki.conf with a couple of Aliases:

Alias /mediawiki /var/lib/mediawiki
Alias /wiki /var/lib/mediawiki/index.php

Looking in this, most of the stuff is simply links from /usr/share/mediawiki/ so it should be easy to create a whole new root.

So to create a new Wiki on shonky.com which is at /data/www/shonky.com the best way should be to create a wiki directory there, then to make the appropriate links and copies - So:

root@eris:/etc/mediawiki# cd /var/www/shonky.com/
root@eris:/var/www/shonky.com# mkdir mediawiki
root@eris:/var/www/shonky.com# cd mediawiki/
root@eris:/var/www/shonky.com/mediawiki# mkdir images
root@eris:/var/www/shonky.com/mediawiki# chown www-data.www-data images
root@eris:/var/www/shonky.com/mediawiki# mkdir config
root@eris:/var/www/shonky.com/mediawiki# chown www-data.www-data config
root@eris:/var/www/shonky.com/mediawiki# mkdir upload
root@eris:/var/www/shonky.com/mediawiki# chown www-data.www-data upload
root@eris:/var/www/shonky.com/mediawiki# ln -fs /usr/share/mediawiki/* .
root@eris:/data/www/shonky.com/mediawiki# rm maintenance
root@eris:/data/www/shonky.com/mediawiki# cp -r /usr/share/mediawiki/maintenance .
root@eris:/var/www/shonky.com/mediawiki# rm LocalSettings.php

root@eris:/var/www/shonky.com/mediawiki# cd config/
root@eris:/var/www/shonky.com/mediawiki/config# cp /usr/share/mediawiki/config/index.php .

(In order for the maintenance scripts to work properly they need to be proper copies and not links, that's why we copy them instead of linking. This is worth remembering when you upgrade)

Then edit /etc/apache2/sites-available/shonky.com and pop in:

## Mediawiki
Alias /mediawiki /data/www/shonky.com/mediawiki
## Alias /wiki /data/www/shonky.com/mediawiki/index.php

<Directory /data/www/shonky.com/mediawiki/>
        Options +FollowSymLinks
        AllowOverride All
        order allow,deny
        allow from all
</Directory>

# some directories must be protected
<Directory /data/www/shonky.com/mediawiki/config>
        Options -FollowSymLinks
        AllowOverride None
</Directory>
<Directory /data/www/shonky.com//mediawiki/upload>
        Options -FollowSymLinks
        AllowOverride None
</Directory>

Run: apache2ctl restart

Then go to http://shonky.com/mediawiki and click on configure, or just straight to http://shonky.com/mediawiki/config/index.php


Wiki name: Shonky Admin username and Password should be obvious as should most other things until Database...

Database type: MySQL Database host: localhost Database name: wickidb DB username: USER DB password: PASS

Database table prefix: shonky_

Click install and it should be good.

It will tell you: Installation successful! Move /var/lib/mediawiki/config/LocalSettings.php to /etc/mediawiki - Don't just:

root@eris:/var/www/shonky.com/mediawiki/config# mv LocalSettings.php .. root@eris:/var/www/shonky.com/mediawiki/config# cd .. root@eris:/var/www/shonky.com/mediawiki# rm -rf config/

Now check it works - Which it will and then edit /etc/apache2/sites-available/shonky.com and remove the comment from the 2nd Alias and restart Apache.

To keep everything neat: ln -fs /data/www/shonky.com/mediawiki/LocalSettings.php /etc/mediawiki/LocalSettings.shonky.php

Now edit /etc/mediawiki/LocalSettings.shonky.php and make a few changes around the Sitename bit:

#####################################################################################
## MJL Bits

$wgSitename         = "Shonky";
$wgLogo = "http://shonky.com/castle-sm.jpg";

# Lots of this is from: http://www.mediawiki.org/wiki/Manual:Preventing_access
# Prevent new user registrations except by sysops
$wgGroupPermissions['*']['createaccount'] = false;
# Restrict anonymous editing and hide user tools for anonymous (IP) visitors.
$wgGroupPermissions['*']['edit'] = false;

$wgShowIPinHeader = false;

# Enable File Uploads - This is also mentioned later but commented out.
# The images directory also needs to be set writeable. ( chmod 770 /data/www/shonky.com/mediawiki/images )
# And check ownership is www-data.www-data
$wgEnableUploads = true;

# Now from http://www.mediawiki.org/wiki/Manual:Short_URL#Recommended_how-to_guide_.28setup_used_on_Wikipedia.29
# We'll enable short forms for the rewrites - We will go with http://shonky.com/wiki/XXX
$wgArticlePath = "/wiki/$1";  # Virtual path. This directory MUST be different from the one used in $wgScriptPath
$wgUsePathInfo = true;        # Enable use of pretty URLs

#####################################################################################

And comment out wgEnableUploads = false; later in the file.

It should all be ok now...

Quick and dirty walkthrough of the above - Updated

Michael 04:15, 29 January 2011 (AST)


Walkthrough for installing a brand new and separate Wiki on a site with an existing db (not that that matters)

cd /data/www/freecycle.me
tar vzxf /opt/mediawiki-1.16.1.tar.gz
mv mediawiki-1.16.1 mediawiki
cd /data/www/freecycle.me/mediawiki
chmod a+w config

# Now configure the thing on the net by going to http://freecycle.me/mediawiki

mv config/LocalSettings.php /etc/mediawiki/LocalSettings.freecycle.php
ls -la /etc/mediawiki/
chown root.root /etc/mediawiki/LocalSettings.freecycle.php
chmod 755 /etc/mediawiki/LocalSettings.freecycle.php
ln -fs /etc/mediawiki/LocalSettings.freecycle.php LocalSettings.php
rm -rf config/
cd extensions/
cp -r /opt/mediawiki/extensions/* .
cd /data/www/freecycle.me
cp ../eastnet.ca/.htaccess .

# Edit .htaccess to make it /mediawiki not /site

: /etc/mediawiki/LocalSettings.freecycle.php

Had to add:

# We define this to allow the configuration file to be explicitly
# located in /etc/mediawiki.
# Change this if you are setting up multisite wikis on your server.
define('MW_INSTALL_PATH','/data/www/freecycle.me/mediawiki');

And:

####################################################
# MJL Bits

$wgSitename         = "Freecycle";
$wgLogo = "http://uknet.com/freecycle/Logos/freecyclefree-mini.jpg";

# Lots of this is from: http://www.mediawiki.org/wiki/Manual:Preventing_access
# Prevent new user registrations except by sysops
$wgGroupPermissions['*']['createaccount'] = false;
# Restrict anonymous editing and hide user tools for anonymous (IP) visitors.
$wgGroupPermissions['*']['edit'] = false;
$wgShowIPinHeader = false;

# Enable File Uploads - This is also mentioned later but commented out.
# The images directory also needs to be set writeable. ( chmod 770 /var/lib/mediawiki/images )
# And check ownership is www-data.www-data
$wgEnableUploads = true;

# Now from http://www.mediawiki.org/wiki/Manual:Short_URL#Recommended_how-to_guide_.28setup_used_on_Wikipedia.29
# We'll enable short forms for the rewrites - We will go with http://freecycle.me/wiki/XXX - Remember this
# needs to be set up in the Apache configuration to work.
$wgArticlePath = "/wiki/$1";  # Virtual path. This directory MUST be different from the one used in $wgScriptPath
$wgUsePathInfo = true;        # Enable use of pretty URLs

# Let's allow external images.
$wgAllowExternalImages = true;


####################################################

## The URL base path to the directory containing the wiki;
## defaults for all runtime URL paths are based off of this.
## For more information on customizing the URLs please see:
## http://www.mediawiki.org/wiki/Manual:Short_URL
$wgScriptPath       = "/mediawiki";
$wgScriptExtension  = ".php";




----------
Look and feel.

http://www.freecycle.me/wiki/MediaWiki:Common.css

/* CSS placed here will be applied to all skins */
/*   

Decided not to go with:

font-family: Tahoma;

*/

* {;
  font-family: arial;
  font-size: 14px;
}


http://freecycle.me/wiki/MediaWiki:Sidebar is the side bar.


Finally add all the extensions in from the other LocalSettings files, but beware that checkUser needs some pre-configuration or it breaks everything.
check http://shonky.com/wiki/MediaWiki#CheckUser for more info there.


Restrict Reading Access

Michael 15:44, 13 May 2010 (ADT)

For the shonky.com Wiki we only want the front page readable - Everything else is restricted to logged in users.

Add the following to /etc/mediawiki/LocalSettings.shonky.php :

# Disable reading by anonymous users
$wgGroupPermissions['*']['read'] = false;
# But allow them to read these pages:
$wgWhitelistRead =  array ( "Main Page", "Special:Userlogin", "Help:Contents");


Pretty Colours

Michael 22:45, 24 May 2010 (ADT)

From: http://commons.wikimedia.org/w/index.php?title=User:Mattes/Complete_index

[[Image:Wolfgang Amadeus Mozart - Clarinet Concerto - 1. Allegro.ogg|50px|right]]
[[Image:Holy-infs.jpg|right|140px|Holy infants embracing by Leonardo da Vinci, circa 1486]]

<div style="font-size:120%; font-family:'Palatino Linotype', serif; color:#9400D3; background-color:pink;">
[[File:Complete index - animated, magical wishes - Pookatoo.gif|300px|center]]
<center>of pages in the user namespace [[User:Mattes]]</center>

<span style="text-shadow:grey 0.15em 0.15em 0.2em; class=texhtml">This page lists all created categories and pages within my Wikimedia Commons user namespace.

Sorted by topic (first) and alphabetic order (second), if red the page is yet empty.</span>

{{keypress|under construction}}

Upgrading

https://www.mediawiki.org/wiki/Manual:Upgrading is a good start.