MediaWiki
Installation and configuration
MySQL database server and PHP
For more info: MySQL
sudo apt-get install install apache2 mysql-server php5 php5-mysql
MediaWiki website files
Download the code and copy to /var/www/mediawiki
Edit LocalSettings.php to add extensions and to customize.
Configuration LocalSettings.php
sudo gedit /var/www/mediawiki/LocalSettings.php
#GeshiHighlight, download from http://qbnz.com/highlighter/
require_once("$IP/extensions/GeshiHighlight.php");
$wgSyntaxHighlightDefaultLang = "bash";
# Disable reading by anonymous users
$wgGroupPermissions['*']['read'] = false;
# But allow them to access the login page or else there will be no way to log in!
$wgWhitelistRead = array ("Special:Userlogin", "MediaWiki:Common.css",
"MediaWiki:Common.js", "MediaWiki:Monobook.css", "MediaWiki:Monobook.js", "-");
# Disable anonymous editing
$wgGroupPermissions['*']['edit'] = false;
# Prevent new user registrations except by sysops
$wgGroupPermissions['*']['createaccount'] = false;
# Custom favorite icon /mediawiki/favicon.ico
$wgFavicon = "$wgScriptPath/favicon.ico";
# Enable uploads to .../mediawiki/images
# remember to include these files in your backup
$wgEnableUploads = true;
Apache2 webserver configuration
sudo gedit /etc/apache2/sites-available/http_wilbertvolkers.dyndns.org
<VirtualHost *:80>
Servername mediawiki.wilbertvolkers.dyndns.org
#redirect UserLogin page to https
# you will need to configure your https as well
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/mediawiki/index.php$
RewriteCond %{QUERY_STRING} ^title=Special:UserLogin
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1 [R]
DocumentRoot /var/www/
Alias /mediawiki/ /var/www/mediawiki/
<Directory /var/www/mediawiki/>
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerSignature Off
</VirtualHost>
If you login using http your password will be send over the net in 'clear text'. To force login via https the RewriteRule is added, however, you will also need to configure the SSL part of your website. Read Create certificates for Apache2.
The mediawiki - part in the configuration file will look something like this:
sudo gedit /etc/apache2/sites-available/https_wilbertvolkers.dyndns.org
... <VirtualHost *:443> ... # mediawiki directory https Alias /mediawiki/ /var/www/mediawiki/ <Directory /var/www/mediawiki/> SSLRequireSSL AllowOverride None Order deny,allow Allow from all </Directory> ... </VirtualHost>
PHP configuration
With wikimedia, when you import or export all pages or when you upload images and files, this will take more space and time that normally is allowed by PHP. Change theses settings:
locate php.ini sudo gedit /..path../php.ini
... upload_max_filesize = 10M ... post_max_size = 10M ... max_execution_time = 600 ; 10min ... max_input_time = 600 ; 10min
Restart Apache2 to apply the settings:
service apache2 restart
Categories
Use categories to group your pages by including one or more Category tags:
[[Category:Name]]
Try to distribute your pages evenly over categories, first look here if any of the available categories can be used:
Tips
Keywords
You can make the search tool more efficient if you add synonyms and keywords to a page. You might want to keep these hidden from the reader to keep the text readable . Insert like this:
<!-- hidden text -->
Hotkeys
The tooltips will show you the letter of the shortcut between brackets. You need to press SHIFT+ALT+<letter> to use it.
Shortcuts:
- SHIFT+ALT+Z main page
- SHIFT+ALT+E start edit (if allowed)
- you can also right click on the section or click the [edit] link
- SHIFT+ALT+P preview
- SHIFT+ALT+S save
- SHIFT+ALT+C cancel
Modify the [edit] link to be smaller with "myskin":
sudo gedit /var/www/mediawiki/skins/myskin/main.css
/* change edit-link size */
span.editsection {
font-size: 30%;
float: right;
margin-left: 5px;
}
Special Import / Export pages
Import (as Admin)
Export pages
Export full contents
sudo php maintenance/dumpBackup.php --full --uploads > ../wiki_dump.xml
See also
Go to Apache2 webserver to read about installing and configuring Apache2 webserver.
Accidentally committed information that really needs to be removed? Go to: Permanently remove a MediaWiki revision using SQL.
MediaWiki help pages
- http://www.mediawiki.org/wiki/Manual:Configuration_settings
- http://www.mediawiki.org/wiki/Help:Formatting
- http://www.mediawiki.org/wiki/Manual:Installing_MediaWiki
- http://www.mediawiki.org/wiki/Manual:Running_MediaWiki_on_Ubuntu
- http://www.mediawiki.org/wiki/Manual:Configuration_settings#Database_settings