Check out my first novel, midnight's simulacra!
MediaWiki: Difference between revisions
(15 intermediate revisions by the same user not shown) | |||
Line 26: | Line 26: | ||
* memcached works out of the box, but doesn't seem very effective | * memcached works out of the box, but doesn't seem very effective | ||
** You want the memcache server at 127.0.0.1:11211 | ** You want the memcache server at 127.0.0.1:11211 | ||
* Ensure <tt>mod_deflate</tt>'s compressing standard html/xml etc, and also <tt>application/x-javascript</tt> and <tt>text/css</tt> | |||
==Postinstallation== | ==Postinstallation== | ||
* [http://www.mediawiki.org/wiki/Project:PD_help/Copying Install help pages] using Import/Export. | |||
** They require the ParserFunctions extension. Be sure to get the proper version for your MediaWiki install. | |||
* Set a wiki logo: <tt>sudoedit /etc/mediawiki/LocalSettings.php</tt> and add | * Set a wiki logo: <tt>sudoedit /etc/mediawiki/LocalSettings.php</tt> and add | ||
** <code>$wgLogo = "/mediawiki/skins/common/images/wiki.jpg";</code> with the appropriate path to your logo | ** <code>$wgLogo = "/mediawiki/skins/common/images/wiki.jpg";</code> with the appropriate path to your logo | ||
Line 34: | Line 37: | ||
** If applicable, set the image background transparent so it'll look better | ** If applicable, set the image background transparent so it'll look better | ||
*** Using the Gimp, add an Alpha layer, select the background with the Magic Wand, and Clear it | *** Using the Gimp, add an Alpha layer, select the background with the Magic Wand, and Clear it | ||
* Support inline equations: <tt>sudoedit /etc/mediawiki/LocalSettings.php</tt> and change | * Support inline equations: <tt>sudoedit /etc/mediawiki/LocalSettings.php</tt> and change | ||
** <code>$wgUseTeX = false;</code> so that it uses <tt>true</tt> instead | ** <code>$wgUseTeX = false;</code> so that it uses <tt>true</tt> instead | ||
Line 50: | Line 42: | ||
* Disable editing unless logged in: <tt>sudoedit /etc/mediawiki/LocalSettings.php</tt> and add | * Disable editing unless logged in: <tt>sudoedit /etc/mediawiki/LocalSettings.php</tt> and add | ||
** <code>$wgGroupPermissions['*']['edit'] = false;</code> | ** <code>$wgGroupPermissions['*']['edit'] = false;</code> | ||
* Disable per-IP pages:<tt>sudoedit /etc/mediawiki/LocalSettings.php</tt> and add | |||
** <code>$wgShowIPinHeader = false;</code> | |||
* Optionally, disable new accounts unless logged in: <tt>sudoedit /etc/mediawiki/LocalSettings.php</tt> and add | * Optionally, disable new accounts unless logged in: <tt>sudoedit /etc/mediawiki/LocalSettings.php</tt> and add | ||
** <code>$wgGroupPermissions['*']['createaccount'] = false;</code> | ** <code>$wgGroupPermissions['*']['createaccount'] = false;</code> | ||
Line 55: | Line 49: | ||
** Load <tt>Mediawiki:mainpage</tt>, and update it to reflect this change | ** Load <tt>Mediawiki:mainpage</tt>, and update it to reflect this change | ||
* Optionally, remove the 'discussion' tab: | * Optionally, remove the 'discussion' tab: | ||
** Edit <tt>mediawiki/ | ** Edit [[MediaWiki:Common.css]], and add the following:<code>#ca-talk { display:none!important; }</code> | ||
$ | ** Ensure <tt>$wgUseSiteCss=true</tt> in LocalSettings.php | ||
===Managing Uploads=== | |||
* Enable uploads: <tt>sudoedit /etc/mediawiki/LocalSettings.php</tt> and add | |||
** <code>$wgEnableUploads = true;</code> | |||
* Support uploading non-images: <tt>sudoedit /etc/mediawiki/LocalSettings.php</tt> and add | |||
** <pre>$wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg', 'doc', 'pdf', 'ps', 'xls', 'txt', 'svg' );</pre> | |||
** Supposedly, all types can be allowed via: | |||
<pre> | |||
$wgCheckFileExtensions = false; | |||
$wgStrictFileExtensions = false; | |||
$wgVerifyMimeType = false; | |||
$wgFileBlacklist = array(); | |||
$wgMimeTypeBlacklist= array(); | |||
</pre> | |||
* To allow files larger than the default 2M to be uploaded, edit the value of <tt>upload_max_filesize</tt> in <tt>/etc/php.ini</tt> | |||
** This requires a web server restart to take effect | |||
===System strings=== | |||
Most strings in e.g. sidebars can be edited in the Special:AllMessages area. To see what message key a string corresponds to, add "uselang=qqx" to a URI, e.g. https://nick-black.com/dankwiki/index.php?title=User:Dank&uselang=qqx. | |||
==Moving a wiki== | |||
There's a [http://www.mediawiki.org/wiki/Manual:Moving_a_wiki manual entry] on this. My notes follow: | |||
* The uploaded files are '''not''' stored in your database, and need be copied by themselves | |||
** By default, this is the 'images' directory off your wiki toplevel | |||
** Use a copying method that preserves timestamps, such as tar | |||
* Be sure you grab your configuration files, particularly /etc/mediawiki/LocalSettings.php | |||
* You will also likely want to transfer your web server config as it relates to the wiki | |||
* If you're using Mediawiki account permissions only, they'll be stored in your wiki database | |||
** Otherwise, you'll of course need to copy over and prepare this supporting infrastructure | |||
* Export your database with mysqldump as explained in the manual, and import it on the new machine | |||
* If you can't do a database dump/load, you can do an XML export of all your pages | |||
** This won't copy things like account data! | |||
==Maintenance== | ==Maintenance== | ||
Line 85: | Line 105: | ||
===Enabling other Extensions=== | ===Enabling other Extensions=== | ||
* Download the extension to <tt>/var/lib/ | * Download the extension to <tt>/var/lib/mediawiki/extensions</tt> | ||
* See <tt>/var/lib/mediawiki/extensions/README</tt> for up-to-date information on enabling it | * See <tt>/var/lib/mediawiki/extensions/README</tt> for up-to-date information on enabling it | ||
* Worth noting: [http://www.mediawiki.org/wiki/Extension:Google_Analytics_Integration googleAnalytics], [http://www.mediawiki.org/wiki/Extension:Countdown Countdown], [http://www.mediawiki.org/wiki/Extension:RSS RSSNews] | |||
==Editing== | |||
Wikipedia's tutorials and the Mediawiki help pages are the best references here: | |||
* [http://en.wikipedia.org/wiki/Image_tutorial Wikipedia image tutorial] | |||
I also have [[MediaWiki editing|some information]]. | |||
===Editing permissions=== | |||
Some editing capabilities are by default disabled even for sysops: | |||
<pre> | |||
$wgGroupPermissions['sysop']['deleterevision'] = true; | |||
$wgGroupPermissions['sysop']['editsitecss'] = true; | |||
$wgGroupPermissions['sysop']['editsitejs'] = true; | |||
</pre> | |||
==See Also== | |||
* [http://www.debian-administration.org/articles/137 mod_deflate configuration] for [[Debian]] |
Latest revision as of 01:11, 12 May 2023
I'm using the MediaWiki software from the WikiMedia Foundation to power my wikis. MediaWiki is written in PHP5, and thus precludes the use of a multi-threaded version of Apache.
Installing MediaWiki
The following information is largely Debian-specific.
- Have handy the administrator account/password for your MySQL installation.
- I advise you to install MySQL before MediaWiki, not as a single apt step.
- DO NOT explicitly create the MediaWiki databases / users yourself.
- Grab the necessary packages:
- mediawiki and mediawiki-math; mediawiki-extensions is also advised.
- In addition, memcached, imagemagick and tetex-base should be installed if they're not automatically dragged in.
- Don't grab the versioned packages (ie mediawiki1.10); the mediawiki package will depend on the proper packages for your version of Debian.
- Unless you really need a particular version.
- If you install the versioned packages explicitly, upgrades might eat your configuration. You have been warned.
- Symlink /var/lib/mediawiki to /var/www/mediawiki with ln -s.
- This isn't in the install docs, and might be incorrect/suboptimal FIXME.
- Go to http://yourhost/mediawiki. You should be greeted with a link to the config page. Follow it.
- Configure that bitch (See Accelerators below).
- I've seen no problems related to the experimental UTF-8 encoding for use with MySQL 5.0.
- Following configuration, run chmod 640 /var/lib/mediawiki/config/LocalSettings.php && ln -sf /var/lib/mediawiki/config/LocalSettings.php /etc/mediawiki
- Go to http://yourhost/mediawiki. You should be greeted with your new main page.
Accelerators
- MediaWiki: kinda slow.
- XCache is rumoured to be the best choice.
- On Debian, you'll need edit the default /etc/php5/xcache.ini to provide non-0 size values
- memcached works out of the box, but doesn't seem very effective
- You want the memcache server at 127.0.0.1:11211
- Ensure mod_deflate's compressing standard html/xml etc, and also application/x-javascript and text/css
Postinstallation
- Install help pages using Import/Export.
- They require the ParserFunctions extension. Be sure to get the proper version for your MediaWiki install.
- Set a wiki logo: sudoedit /etc/mediawiki/LocalSettings.php and add
$wgLogo = "/mediawiki/skins/common/images/wiki.jpg";
with the appropriate path to your logo- Be sure the image is world-readable, 135x135 and has a correct extension
- The path is relative to your Apache's configured DocumentRoot
- If applicable, set the image background transparent so it'll look better
- Using the Gimp, add an Alpha layer, select the background with the Magic Wand, and Clear it
- Support inline equations: sudoedit /etc/mediawiki/LocalSettings.php and change
$wgUseTeX = false;
so that it uses true instead- The texex-bin package must be installed for this to work!
- Disable editing unless logged in: sudoedit /etc/mediawiki/LocalSettings.php and add
$wgGroupPermissions['*']['edit'] = false;
- Disable per-IP pages:sudoedit /etc/mediawiki/LocalSettings.php and add
$wgShowIPinHeader = false;
- Optionally, disable new accounts unless logged in: sudoedit /etc/mediawiki/LocalSettings.php and add
$wgGroupPermissions['*']['createaccount'] = false;
- Optionally, rename the main page: first, move the main page to the new title
- Load Mediawiki:mainpage, and update it to reflect this change
- Optionally, remove the 'discussion' tab:
- Edit MediaWiki:Common.css, and add the following:
#ca-talk { display:none!important; }
- Ensure $wgUseSiteCss=true in LocalSettings.php
- Edit MediaWiki:Common.css, and add the following:
Managing Uploads
- Enable uploads: sudoedit /etc/mediawiki/LocalSettings.php and add
$wgEnableUploads = true;
- Support uploading non-images: sudoedit /etc/mediawiki/LocalSettings.php and add
$wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg', 'doc', 'pdf', 'ps', 'xls', 'txt', 'svg' );
- Supposedly, all types can be allowed via:
$wgCheckFileExtensions = false; $wgStrictFileExtensions = false; $wgVerifyMimeType = false; $wgFileBlacklist = array(); $wgMimeTypeBlacklist= array();
- To allow files larger than the default 2M to be uploaded, edit the value of upload_max_filesize in /etc/php.ini
- This requires a web server restart to take effect
System strings
Most strings in e.g. sidebars can be edited in the Special:AllMessages area. To see what message key a string corresponds to, add "uselang=qqx" to a URI, e.g. https://nick-black.com/dankwiki/index.php?title=User:Dank&uselang=qqx.
Moving a wiki
There's a manual entry on this. My notes follow:
- The uploaded files are not stored in your database, and need be copied by themselves
- By default, this is the 'images' directory off your wiki toplevel
- Use a copying method that preserves timestamps, such as tar
- Be sure you grab your configuration files, particularly /etc/mediawiki/LocalSettings.php
- You will also likely want to transfer your web server config as it relates to the wiki
- If you're using Mediawiki account permissions only, they'll be stored in your wiki database
- Otherwise, you'll of course need to copy over and prepare this supporting infrastructure
- Export your database with mysqldump as explained in the manual, and import it on the new machine
- If you can't do a database dump/load, you can do an XML export of all your pages
- This won't copy things like account data!
Maintenance
- The MediaWiki manual has good information scattered through it; check the system administration page for sure
- Most everything can be done via the Special Pages page; learn it
- Check the Special:Lonelypages list to watch for orphaned pages; these pages are unreachable from any other page.
- This almost always indicates a mistyped or misspelled attempt to link to this page; check the Special:Wantedpages list
- Check the Special:Deadendpages list to watch for dead-end pages; these pages link to no other pages.
- This almost always indicated a failure to add a relevant link, or a short entry (see below)
- Check the Special:Shortpages list to watch for short pages; these pages might need more information.
- See if the page can't be combined with another one, or if more info isn't sensible to add
- How to check for dead external links? FIXME
- Use the generateSitemap.php maintenance script to generate sitemaps; these can be registered with search services.
Extensions
A variety of extensions are available for MediaWiki. The most popular and stable are collected in the Debian package mediawiki-extensions, including (as of 1.10) GeSHi, Cite, inputbox, and ParserFunctions. By default, none are enabled -- the package only provides the extensions; it does not enable them!
Enabling Debian-Supported Extensions
- Install the mediawiki-extensions package.
- Enter the /etc/mediawiki-extensions/extensions-enabled directory.
- Enable extensions by creating symbolic links to contents of the /etc/mediawiki-extensions/extensions-available directory.
- To enable all extensions, run: for i in ../extensions-available/* ; do sudo ln -s /etc/mediawiki-extensions/extensions-available/`basename $i` . ; done
Enabling other Extensions
- Download the extension to /var/lib/mediawiki/extensions
- See /var/lib/mediawiki/extensions/README for up-to-date information on enabling it
- Worth noting: googleAnalytics, Countdown, RSSNews
Editing
Wikipedia's tutorials and the Mediawiki help pages are the best references here:
I also have some information.
Editing permissions
Some editing capabilities are by default disabled even for sysops:
$wgGroupPermissions['sysop']['deleterevision'] = true; $wgGroupPermissions['sysop']['editsitecss'] = true; $wgGroupPermissions['sysop']['editsitejs'] = true;