Setup a Project Wiki: Difference between revisions

From Research
Jump to navigation Jump to search
Line 83: Line 83:
Another gotcha can be that the file-extension is blacklisted (as in the case of 'exe').  In this case, edit LocalSettings.php to permit the file-type, '''and''' also un-BlackList it (settings in LocalSettings.php over-ride the same settings made elsewhere, like DefaultSettings.php):
Another gotcha can be that the file-extension is blacklisted (as in the case of 'exe').  In this case, edit LocalSettings.php to permit the file-type, '''and''' also un-BlackList it (settings in LocalSettings.php over-ride the same settings made elsewhere, like DefaultSettings.php):
   
   
  <font color=red>hostname</font> <font color=blue>~ #</font> '''emacs -nw /home/projects/infrastructure/htdocs/wiki/LocalSettings.php <br>
  <font color=red>tirpitz</font> <font color=blue>~ #</font> '''emacs -nw /home/projects/infrastructure/htdocs/wiki/LocalSettings.php <br>
           $wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg', 'swf', 'pdf', 'exe', 'bin', 'dmg', 'reg', 'tbz2', 'zip' );
           $wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg', 'swf', 'pdf', 'exe', 'bin', 'dmg', 'reg', 'tbz2', 'zip' );
   
   

Revision as of 20:11, 2 April 2007

Kingfisher is our wiki server. Check out the wiki index to see existing wikis.

Add a Separate Instance of MediaWiki

To set the stage for a new wiki, the champion for this new wiki should provide a wiki-name, and be clear about the type of access they want.

hostname ~ # ssh root@kingfisher
hostname ~ # cd /srv/www/htwiki
hostname ~ # tar -xzvf mediawiki-unconfiguredInstallation.tar.gz
hostname ~ # mv mediawiki $projectname

The go to the mediawiki setup website for your project: http://wiki.iat.sfu.ca/$projectname

Fill in the options appropriately with some special Configuration options to note:

Leave the Sysop account name as WikiSysop; apply our strong password to this account.

Make a separate database for each project:

  • Database name: wiki_$projectname

Seperate username for each project:

  • DB username: wiki_$projectname

Unique password:

hostname ~ # apg -m 9 -MNC

And no table prefix.

DB root password is again our strong password.

Note: When you click Install! it may fail. For me it has always failed if the username was too long (it must be at 16 characters or less)

If it worked, this will create the LocalSettings.php file which you then move to the correct place:

hostname htwiki # cd $projectname
hostname wiki_name # mv config/LocalSettings.php ./

Config should no longer be world writable:

hostname ~ # chmod a-w config

Your wiki should be completely setup at: http://wiki.iat.sfu.ca/$projectname

I then usually go login to the wiki and add to the main page: Wiki is configured correctly. for 100% assurance that everything is working :)

To customize access and viewing restrictions, look at this article on Preventing Access (this version of mediawiki is 1.4). It's probably always a good idea to prohibit anonymous edits; add these lines to LocalSettings.php:

hostname wiki_name # emacs -nw LocalSettings.php
         # Entirely disable Anonymous Edits in Wiki versions 1.4 and before
         $wgWhitelistEdit = true;

Record the database username & password, and who this wiki was created for in our 'MediaWiki on Kingfisher' file.

Add Sysop/Administrator User

Follow these steps to make a wiki account, a sysop account:

Create the account, if you haven't done so already. Logout. Login as the WikiSysop user.

Navigate to Special Pages -> Make a user into a sysop, or modify this link with your project name: http://wiki.iat.sfu.ca/$projectname/index.php/Special:Makesysop

Enter the username and set bureaucrat flag too.

Customizing

Permitted Upload File Extensions

Kingfisher (Wiki-city)

All changes should be made to /srv/www/htwiki/<project_name>/LocalSettings.php. In most cases the variable you want to adjust is already defined under includes/DefaultSettings.php, but this may be over-written during upgrades!! Typical examples are to enable or disable all file uploading:

hostname ~ # emacs -nw /srv/www/htwiki/<project_name>/LocalSettings.php
         $wgDisableUploads             = false;
         $wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg', 'pdf', 'fls', 'swf', 'doc', 'jar', 'dmg' );

After this, check the user/permissions on the $projectname/images directory. Change:

hostname htwiki # chown wwwrun:www images

Suitable permissions for images/ would be 755

 hostname htwiki # chmod 755 images/

Tirpitz (Research wiki)

Things are Different on Tirpitz (tm) :-)
Changes are made on an NFS-mounted directory /home/projects/infrastructure/htdocs/wiki

Another gotcha can be that the file-extension is blacklisted (as in the case of 'exe'). In this case, edit LocalSettings.php to permit the file-type, and also un-BlackList it (settings in LocalSettings.php over-ride the same settings made elsewhere, like DefaultSettings.php):

tirpitz ~ # emacs -nw /home/projects/infrastructure/htdocs/wiki/LocalSettings.php 
$wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg', 'swf', 'pdf', 'exe', 'bin', 'dmg', 'reg', 'tbz2', 'zip' ); /** Files with these extensions will never be allowed as uploads. */ $wgFileBlacklist = array( # HTML may contain cookie-stealing JavaScript and web bugs 'html', 'htm', 'js', 'jsb', # PHP scripts may execute arbitrary code on the server 'php', 'phtml', 'php3', 'php4', 'phps', # Other types that may be interpreted by some servers 'shtml', 'jhtml', 'pl', 'py', 'cgi', # May contain harmful executables for Windows victims 'exe', 'scr', 'dll', 'msi', 'vbs', 'bat', 'com', 'pif', 'cmd', 'vxd', 'cpl' ); # 'scr', 'dll', 'msi', 'vbs', 'bat', 'com', 'pif', 'cmd', 'vxd', 'cpl' );

Upload (filesize) Limits

Filesize limits can be tricky - Mediawiki just follows general apache and php limitations. When Mediawiki encounters a filesize limitation, it seems to (unhelpfully :-( ) fail silently; you'll usually just get a blank Upload file page again. Let's increase these limits (tirpitz - our main Research wiki - used as an example):

hostname ~ # emacs -nw /etc/php/cgi-php5/php.ini
         memory_limit "128M"
         file_uploads "On"
         post_max_size "25M"
         upload_max_filesize "25M"