How to Install MediaWiki in a LAMP Server

MediaWiki is an Open Source knowledgebase application. If you are trying to create an internal or external knowledge source where you save your own personal docs and other information, MediaWiki is the best option. It is coded in PHP and uses database management systems like MySQL to save data. To fetch MediaWiki contents via browser, LAMP setup is required and this tutorial is in assumption that LAMP stack is already setup.

3 Steps to Install MediaWiki

It is really easy to install even if you are not using any control panel in your hosting server. Installing MediaWiki involves 3 processes.

1. Downloading and extracting MediaWiki files in the Document Root.

2. Creating a MySQL database and its privileged user.

3. Setting up MediWiki via frontend.

Downloading and extracting MediaWiki files in the Document Root

=================================================

Change current working directory to the Document Root of the website/web server.

cd /path/to/document/root

Download the MediaWiki package from their official page.

wget http://download.wikimedia.org/mediawiki/1.21/mediawiki-1.21.2.tar.gz

Extract the tar file

tar xvzf mediawiki-*.tar.gz

This will extract all the files and folders in the archive file to the directory mediawiki-1.21.2, so we need to move the files to Document Root.

mv mediawiki-1.21.2/* /path/to/document/root

With this, all the files, folders, application libraries etc are copied to the Document Root.

Creating a MySQL database and its privileged user

=====================================

Goto MySQL command prompt for creating MySQL database, MySQL user and granting privileges for that user to access the database.

mysql -u root -p

Enter the MySQL root password when prompted and that will take you to the MySQL command prompt.

Create databse from MySQL command prompt,

CREATE DATABASE pickaweb_mwiki;

Create MySQL user to access this database,

CREATE USER [email protected];

Set password for the MySQL user,

SET PASSWORD FOR [email protected]= PASSWORD("your_password");

Grant full privileges for this MySQL user to access the database,

GRANT ALL PRIVILEGES ON pickaweb_mwiki.* TO [email protected] IDENTIFIED BY 'your_password';

Flush MySQL privileges for the changes to take effect,

FLUSH PRIVILEGES;

Exit out of MySQL prompt

exit

Files and Database is now ready. You can refer the screenshot below for more information.

media-wiki-01

Setting up MediWiki via frontend

Now we can setup MediaWiki installation with this Database credentials via frontend or by just accessing the website in the browser for eg: http://pickawebtest.com

You may simply follow the screenshots for setting up MediaWiki.

media-wiki-02

Click on set up the wiki link and that will take you to the setup.

media-wiki-03

Change the language to the desired one and click continue.

media-wiki-04

This page just shows the terms and conditions and you can go ahead with the setup by clicking Continue’ button.

media-wiki-05

In this page you need to fill in the database credentials, i.e the MySQL Database name, MySQL user name and MySQL user password that we just created

media-wiki-06

This page is to set the MediaWiki admin ppage with which the admin can manage the installation. You can enter the desired admin user name and password in this page.

media-wiki-07

Just click ‘Continue’ button to proceed with the installation.

media-wiki-08

This page just shows what all is being done, just go ahead with the setup by clicking ‘Continue’.

media-wiki-09

After the setup a configuration file name LocalSettings.php is created by MediaWiki and you need to download the file to the Document Root or the Media wiki installation directory.

With this Installation and Setup of MediaWiki is complete.

Here is a preview of how the default MediaWiki main page looks like.

media-wiki-10

You can add data to this Wiki installation after logging in as the created user. You can see ‘create account’ and ‘log in’ in the main page itself.

And that’s all there is to installing MediaWiki in a LAMP server.

Leave a Reply

Your email address will not be published. Required fields are marked *