How to Install MediaWiki in Ubuntu

To Install MediaWiki in Ubuntu

MediaWiki is a PHP wiki package designed for use on Wikipedia. It allows you to create your own personal wiki site. It is an extremely powerful and a featured wiki implementation, which also shows the data stored in a database. Installation of the MediaWiki in Ubuntu is explained in this article.

Installation of Mediawiki

Before installing mediawiki, you need to install LAMP server with following link,

https://www.linuxhelp.com/how-to-install-lamp-by-using-tasksel-tool-in-ubuntu/

Utilize the following command to install the PHP modules and dependency packages.

root@linuxhelp:/home/user1# apt-get install php5-intl
Reading package lists... Done
Building dependency tree       
Reading state information... Done
..
..
Creating config file /etc/php5/mods-available/intl.ini with new version
php5_invoke: Enable module intl for cli SAPI
php5_invoke: Enable module intl for apache2 SAPI
Processing triggers for libapache2-mod-php5 (5.6.11+dfsg-1ubuntu3.4) ...
root@linuxhelp:/home/user1# apt-get install php5-gd
Reading package lists... Done
Building dependency tree       
Reading state information... Done
&hellip 
&hellip 
php5_invoke: Enable module gd for cli SAPI
php5_invoke: Enable module gd for apache2 SAPI
Processing triggers for libapache2-mod-php5 (5.6.11+dfsg-1ubuntu3.4) ...

If you want to install texlive and php5-xcache packages then run the following command.

root@linuxhelp:/home/user1# apt-get install texlive php5-xcache

Restart the Apache web server to take effect.

root@linuxhelp:/home/user1# service apache2 restart

Now its time to download the mediawiki package.

root@linuxhelp:/home/user1# wget http://releases.wikimedia.org/mediawiki/1.24/mediawiki-1.24.1.tar.gz
--2016-11-23 13:46:11--  http://releases.wikimedia.org/mediawiki/1.24/mediawiki-1.24.1.tar.gz
Resolving releases.wikimedia.org (releases.wikimedia.org)... 91.198.174.217, 2620:0:862:ed1a::3:d
Connecting to releases.wikimedia.org (releases.wikimedia.org)|91.198.174.217|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://releases.wikimedia.org/mediawiki/1.24/mediawiki-1.24.1.tar.gz [following]
--2016-11-23 13:46:12--  https://releases.wikimedia.org/mediawiki/1.24/mediawiki-1.24.1.tar.gz
Connecting to releases.wikimedia.org (releases.wikimedia.org)|91.198.174.217|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 20725572 (20M) [application/x-gzip]
Saving to: ‘ mediawiki-1.24.1.tar.gz’ 
mediawiki-1.24.1.tar.gz   100%[======================================> ]  19.76M   150KB/s   in 2m 22s 
2016-11-23 13:48:35 (143 KB/s) - ‘ mediawiki-1.24.1.tar.gz’  saved [20725572/20725572]

Immediately extract the downloaded package.

root@linuxhelp:/home/user1# tar -xvf mediawiki-1.24.1.tar.gz
mediawiki-1.24.1/
mediawiki-1.24.1/HISTORY
mediawiki-1.24.1/CREDITS
mediawiki-1.24.1/api.php
mediawiki-1.24.1/profileinfo.php5
&hellip 
&hellip 
mediawiki-1.24.1/skins/Modern/resources/images/footer-grad.png
mediawiki-1.24.1/skins/Modern/resources/images/bullet.gif
mediawiki-1.24.1/skins/Modern/resources/images/video.png
mediawiki-1.24.1/skins/Modern/resources/images/discussionitem_icon.gif
mediawiki-1.24.1/skins/Modern/resources/images/document.png

Move the extracted files to HTML directory.

root@linuxhelp:/home/user1# mv mediawiki-1.24.1/* /var/www/html

Once the files are moved, then create a database for mediawiki.

root@linuxhelp:/home/user1# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with   or g.
Your MariaDB connection id is 53
Server version: 10.0.25-MariaDB-0ubuntu0.15.10.1 (Ubuntu)
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type ' help '  or ' h'  for help. Type ' c'  to clear the current input statement.
MariaDB [(none)]>  create database my_wiki 
Query OK, 1 row affected (0.06 sec)
MariaDB [(none)]>  GRANT INDEX, CREATE, SELECT, INSERT, UPDATE, DELETE, ALTER, LOCK TABLES ON my_wiki.* TO ' wiki' @' localhost'  IDENTIFIED BY ' password'  
Query OK, 0 rows affected (0.14 sec)
MariaDB [(none)]>  FLUSH PRIVILEGES 
Query OK, 0 rows affected (0.02 sec)
MariaDB [(none)]>  exit
Bye


Open the web browser and navigate to http://IP address/index.php. Mediawiki installer page will appears as shown below,

Select your language.

Then install the php5-mysql package with the ' ' apt-get' " command.

root@linuxhelp:/var/www/html# apt-get install php5-mysql
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  php5-mysql
&hellip 
&hellip 
Creating config file /etc/php5/mods-available/pdo_mysql.ini with new version
php5_invoke: Enable module pdo_mysql for cli SAPI
php5_invoke: Enable module pdo_mysql for apache2 SAPI
Processing triggers for libapache2-mod-php5 (5.6.11+dfsg-1ubuntu3.4) ...

Again restart the Apache web server to take effect.

root@linuxhelp:/home/user1# service apache2 restart

Refresh the web page to know that problem gets solved or not. Here problem is resolved.

Enter the Database details.

Manage Database settings.

Enter your favorite name for the wiki and administrative account details.

Once the above process is completed, enable the file uploads and enter the Logo URL path.

Click on continue option to begin installation process.

To continue the installation process, click on continue option.

Download LocalSettings.php and click on OK option.

Now copy the contents of LocalSettings.php into /var/www/html/LocalSettings.php

root@linuxhelp:/var/www/html# nano LocalSettings.php

Enter your wiki to view the mediawiki main page.

Login with the user credentials.

Upload files

Special page

Mediawiki preferences

Tag : mediawiki
FAQ
Q
Is it possible to move my MediaWiki to a different machine?
A
Yes.you can move MediaWiki, In essence, you will be backing up your old installation and then "restoring" it onto the new machine.
Q
How do I enable embedded math formulas?
A
MediaWiki allows embedded math formulas.
Q
I want to import the Wiki I developed on WikiSpaces.com to MediaWiki. How to achieve it?
A
It depends on what information/tools do you have to export the wiki.
Q
How do I add extra namespaces in MediaWiki?
A
Do follow the link for installing Mediawiki https://www.mediawiki.org/wiki/Manual:Using_custom_namespaces#Creating_a_custom_namespace
Q
How will this affect other products that the Wikimedia Foundation is developing?
A
The research carried out will help bring more understanding to search and discovery mechanisms across all platforms, and user flows from readers to editors and will inform decisions made on h