Mediawiki: Difference between revisions
Jump to navigation
Jump to search
Line 5: | Line 5: | ||
* install the following packages: | * install the following packages: | ||
<pre> | <pre> | ||
apt install imagemagick php-cli php-fpm php-mysql | apt install imagemagick php-cli php-fpm php-mbstring php-mysql php-xml | ||
</pre> | </pre> | ||
* If the web server is running under a separate deploy user, you will need to edit <code>/etc/php/7.?/fpm/pool.d/www.conf</code> and change the user for <code>listen.owner</code> and <code>listen.group</code> | * If the web server is running under a separate deploy user, you will need to edit <code>/etc/php/7.?/fpm/pool.d/www.conf</code> and change the user for <code>listen.owner</code> and <code>listen.group</code> |
Revision as of 23:15, 14 February 2019
Install on Ubuntu
- ASSUMPTION: MySQL is already installed
- install the following packages:
apt install imagemagick php-cli php-fpm php-mbstring php-mysql php-xml
- If the web server is running under a separate deploy user, you will need to edit
/etc/php/7.?/fpm/pool.d/www.conf
and change the user forlisten.owner
andlisten.group
Upgrade from tarball
- read all Release Notes
- download new tarball from http://www.mediawiki.org/wiki/Download
- unpack in deploy@myserver:wiki/
- copy over LocalSettings.php (which is a pointer to ~/wiki/var/LocalSettings.php)
- make images point to ../var/images
- in extensions, make links to folders in ~/wiki/var/extensions
- make a link to your ../var/my-logo-image.png file (and make sure $wgLogo matches in LocalSettings.php)
- run the database update script:
php maintenance/update.php
Increase the maximum upload file size
- Edit
/etc/php5/apache2/php.ini
to change this line:
; Maximum allowed size for uploaded files. upload_max_filesize = 200M
- restart apache
Allow additional file types for upload
- Edit
/etc/mediawiki/LocalSettings.php
and add something like this:
$wgFileExtensions = array('png', 'gif', 'jpg', 'jpeg', 'doc', 'xls', 'pdf', 'txt');
Add your own logo image
- create a 135x135-pixel logo image and save as png
- copy the png file to
/var/lib/mediawiki1.10/skins/common/images
- edit
/etc/mediawiki1.10/LocalSettings.php
to include this line:
$wgLogo = "/mediawiki/skins/common/images/mylogo.png";
- log in as the admin user
- edit the wiki page http://localhost/mediawiki/index.php/MediaWiki:Sidebar
Lowercase Page Titles
- This helps you fix the titles of pages like "iPhone" that mediawiki automatically converts to "IPhone".
- install and enable the ParserFunctions extension:
apt-get install mediawiki-extensions (if not already installed) mwenext ParserFunctions.php
- open the page Template:Lowercase_title for editing.
- add this code:
<span>{{DISPLAYTITLE:{{#if:{{NAMESPACE}}|{{NAMESPACE}}:|}}{{lcfirst:{{PAGENAME}}}}}}</span><noinclude> {{documentation}} </noinclude>
This can be found on Wikipedia: http://en.wikipedia.org/w/index.php?title=Template:Lowercase_title&action=edit
- add this line to the top of each affected page:
{{lowercase title}}
Syntax highlighting
Use the GeSHi extension included with mediawiki-extensions
: http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi
Custom edit buttons
- download the icons you want to use: http://commons.wikimedia.org/wiki/Mediawiki_edit_toolbar
- download the icons in the images tree and find out where they ended up
- open the MediaWiki:Common.js page on your wiki for editing and add something like this
if (mwCustomEditButtons) {
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "images/2/23/Button_code.png",
"speedTip": "inline <code> tag",
"tagOpen": "<code>",
"tagClose": "</code>",
"sampleText": "Insert code here"};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "images/3/3c/Button_pre.png",
"speedTip": "block <pre> tag",
"tagOpen": "<pre>\n",
"tagClose": "\n</pre>",
"sampleText": "Insert code here"}
}
- hold down the shift key and hit refresh on the browser to get the page to completely reload
Delete History
- Make sure the
php5-cli
package is installed. - cd to
/usr/share/mediawiki/maintenance
- run this:
sudo php deleteOldRevisions.php --delete
Back up the wiki
Use a command like this to dump the wiki database to a flat file:
/usr/bin/mysqldump --opt -u barney -pXXXXXXXX wikidb > /backup/wikidb.sql
May need this command in mysql
to get it to work:
grant lock tables on *.* to barney@localhost; flush privileges;
OLD
Setup
On Ubuntu, install the mediawiki
package. May also want mediawiki-extensions
and mediawiki-math
.
https://help.ubuntu.com/community/MediaWiki
- uncomment alias line of
/etc/apache2/conf.d/mediawiki1.10.conf
- restart apache2
- open a browser window and visit http://localhost/mediawiki
- fill out installation form
- move
/var/lib/mediawiki1.10/config/LocalSettings.php
to/etc/mediawiki1.10/