How to install MediaWiki on Ubuntu 14.04
Version 1.0
Author: Srijan Kishore <s [dot] kishore [at] ispconfig [dot] org>
Follow howtoforge on Twitter
Last edited 23/Sep/2014
This document describes how to install and configure MediaWiki on Ubuntu 14.04. MediaWiki is free server-based software which is licensed under the GNU General Public License (GPL). It's designed to be run on a large server farm for a website that gets millions of hits per day. MediaWiki is an extremely powerful, scalable software and a feature-rich wiki implementation that uses PHP to process and display data stored in a database, such as MySQL. Pages use MediaWiki's wikitext format, so that users without knowledge of XHTML or CSS can edit them easily.
When a user submits an edit to a page, MediaWiki writes it to the database, but without deleting the previous versions of the page, thus allowing easy reverts in case of vandalism or spamming. MediaWiki can manage image and multimedia files, too, which are stored in the filesystem. For large wikis with lots of users, MediaWiki supports caching and can be easily coupled with Squid proxy server software.
I do not issue any guarantee that this will work for you!
1 Preliminary Note
This tutorial is based on Ubuntu 14.04 server, so you should set up a basic Ubuntu 14.04 server installation before you continue with this tutorial. The system should have a static IP address. I use 192.168.0.100 as my IP address in this tutorial and server1.example.com as the hostname. You must have a LAMP server installed in Ubuntu 14.04 as mentioned in the tutorial to continue further.
2 Download
Download the package MediaWiki
cd /tmp
wget http://releases.wikimedia.org/mediawiki/1.23/mediawiki-1.23.3.tar.gz
Extract the file
tar zxvf mediawiki-1.23.3.tar.gz
Move the contents in the Apache document root:
mkdir -p /var/www/html/mediawiki
mv mediawiki-1.23.3/* /var/www/html/mediawiki
3 Database initialization
We need a database for MediaWiki, I will create the database for the MediaWiki as follows:
mysql -u root -p
Here we are adding database=mediawikidb user=mediawikiuser and password=mediawikipassword:
CREATE DATABASE mediawikidb;
CREATE USER mediawikiuser@localhost IDENTIFIED BY 'mediawikipassword';
GRANT index, create, select, insert, update, delete, alter, lock tables on mediawikidb.* TO mediawikiuser@localhost;
Further moving ahead:
FLUSH PRIVILEGES;
exit
Restart services
service apache2 restart
service mysql restart
3 Web installation of MediaWiki
Now we will proceed with the MediaWiki web-installation. Open a browser of your choice and open the link http:192.168.0.100/mediawiki
Select language of your choice and press Continue:
The installer will check your system settings and show that The environment has been checked. You can install MediaWiki Press Continue:
Now it will start the installation process, just give the values as in my my case I gave
Database type MySQL
Database host localhost
Database name mediawikidb
Database prefix mdx (or any value of your choice)
Database username mediawikiuser
Database password mediawikipassword
after filling the values press Continue:
Further installer will ask for Database settings, let the values remain default and press Continue:
Now we need to give some more entries for MediaWiki, the values could differ as per your choice. In my case I am using
Name of wiki: Test-mediawiki
Project namespace: Same as the wiki name
Username: admin
password: howtoforge
email address: [email protected]
And then press Continue:
Now you have choice of making wiki users' rights, you can use any option as per your requirement. In my case I am using Open wiki for understanding the MediaWiki. Further you can select the Copyright and License as per your choice, I am using here GNU free documentation license:
I will take other option as default and press Continue:
Press Continue:
Press Continue:
Press Continue:
It will automatically download a file LocalSettings.php and we need to put it in the Documentroot of the MediaWiki as follows:
touch /var/www/html/mediawiki/LocalSettings.php
nano /var/www/html/mediawiki/LocalSettings.php
Put the contents as it got downloaded in your case, this will vary every time you configure a fresh installation. In my case I am putting my values as per my download, it was:
<?php # This file was automatically generated by the MediaWiki 1.23.3 # installer. If you make manual changes, please keep track in case you # need to recreate them later. # # See includes/DefaultSettings.php for all configurable settings # and their default values, but don't forget to make changes in _this_ # file, not there. # # Further documentation for configuration settings may be found at: # https://www.mediawiki.org/wiki/Manual:Configuration_settings # Protect against web entry if ( !defined( 'MEDIAWIKI' ) ) { exit; } ## Uncomment this to disable output compression # $wgDisableOutputCompression = true; $wgSitename = "Test-mediawiki"; ## 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 ## (like /w/index.php/Page_title to /wiki/Page_title) please see: ## https://www.mediawiki.org/wiki/Manual:Short_URL $wgScriptPath = "/mediawiki"; $wgScriptExtension = ".php"; ## The protocol and server name to use in fully-qualified URLs $wgServer = "http://192.168.0.100"; ## The relative URL path to the skins directory $wgStylePath = "$wgScriptPath/skins"; ## The relative URL path to the logo. Make sure you change this from the default, ## or else you'll overwrite your logo when you upgrade! $wgLogo = "$wgStylePath/common/images/wiki.png"; ## UPO means: this is also a user preference option $wgEnableEmail = true; $wgEnableUserEmail = true; # UPO $wgEmergencyContact = "[email protected]"; $wgPasswordSender = "[email protected]"; $wgEnotifUserTalk = false; # UPO $wgEnotifWatchlist = false; # UPO $wgEmailAuthentication = true; ## Database settings $wgDBtype = "mysql"; $wgDBserver = "localhost"; $wgDBname = "mediawikidb"; $wgDBuser = "mediawikiuser"; $wgDBpassword = "mediawikipassword"; # MySQL specific settings $wgDBprefix = "mdx"; # MySQL table options to use during installation or update $wgDBTableOptions = "ENGINE=InnoDB, DEFAULT CHARSET=binary"; # Experimental charset support for MySQL 5.0. $wgDBmysql5 = false; ## Shared memory settings $wgMainCacheType = CACHE_NONE; $wgMemCachedServers = array(); ## To enable image uploads, make sure the 'images' directory ## is writable, then set this to true: $wgEnableUploads = false; #$wgUseImageMagick = true; #$wgImageMagickConvertCommand = "/usr/bin/convert"; # InstantCommons allows wiki to use images from http://commons.wikimedia.org $wgUseInstantCommons = false; ## If you use ImageMagick (or any other shell command) on a ## Linux server, this will need to be set to the name of an ## available UTF-8 locale $wgShellLocale = "en_US.utf8"; ## If you want to use image uploads under safe mode, ## create the directories images/archive, images/thumb and ## images/temp, and make them all writable. Then uncomment ## this, if it's not already uncommented: #$wgHashedUploadDirectory = false; ## Set $wgCacheDirectory to a writable directory on the web server ## to make your wiki go slightly faster. The directory should not ## be publically accessible from the web. #$wgCacheDirectory = "$IP/cache"; # Site language code, should be one of the list in ./languages/Names.php $wgLanguageCode = "en"; $wgSecretKey = "d2fd3490ab5def0d46849b1595b8f13363421305c4cf718bdff026992fe7264a"; # Site upgrade key. Must be set to a string (default provided) to turn on the # web installer while LocalSettings.php is in place $wgUpgradeKey = "ee8f09827d158760"; ## Default skin: you can change the default skin. Use the internal symbolic ## names, ie 'cologneblue', 'monobook', 'vector': $wgDefaultSkin = "vector"; ## For attaching licensing metadata to pages, and displaying an ## appropriate copyright notice / icon. GNU Free Documentation ## License and Creative Commons licenses are supported so far. $wgRightsPage = ""; # Set to the title of a wiki page that describes your license/copyright $wgRightsUrl = "http://www.gnu.org/copyleft/fdl.html"; $wgRightsText = "GNU Free Documentation License 1.3 or later"; $wgRightsIcon = "{$wgStylePath}/common/images/gnu-fdl.png"; # Path to the GNU diff3 utility. Used for conflict resolution. $wgDiff3 = "/usr/bin/diff3"; # End of automatically generated settings. # Add more configuration options below.
Now we can access our test-wiki at http://192.168.0.100/mediawiki/index.php/Main_Page
The default administrator for the wiki as created before can be used for login in the wiki as Username=admin and Password=howtoforge:
Congratulations! You now we have a fully functional MediaWiki instance on our Ubuntu 14.04 :)
5 Links
- MediaWiki : http://www.mediawiki.org/wiki/MediaWiki
- Ubuntu : http://www.ubuntu.com/