Installing MediaWiki On Ubuntu 22.04

MediaWiki_logo

In this short tutorial we will learn how to install Mediawiki, a collaborative knowledge management tools on Ubuntu 22.04 LTS Operating system. MediaWiki logo is owned by https://www.mediawiki.org.

Introduction

In the vast landscape of information and knowledge management, MediaWiki stands out as a powerful and versatile platform. Originally developed for Wikipedia, the world’s largest online encyclopedia, MediaWiki has evolved into a robust and widely used open-source wiki software. This article explores the key features, benefits, and applications of MediaWiki, shedding light on its role in fostering collaborative knowledge creation and sharing.

Understanding MediaWiki

MediaWiki is a free and open-source wiki software written in PHP. It provides a platform for collaborative editing and management of content, making it an ideal choice for projects that require a shared knowledge base. MediaWiki’s simplicity and flexibility have led to its adoption by a diverse range of organizations, including businesses, educational institutions, and community-driven projects.

MediaWiki Key Features

  1. User-Friendly Editing. MediaWiki employs a simple markup language that allows users with varying levels of technical expertise to contribute content easily. The built-in WYSIWYG (What You See Is What You Get) editor simplifies the editing process, making it accessible to non-technical users.
  2. Version Control. MediaWiki keeps track of every change made to a page, providing a detailed history of edits. Users can compare different versions of a page and revert to previous states if necessary, ensuring a reliable and traceable editing process.
  3. Access Control. Administrators can control user access levels, defining who can view, edit, or create content. This feature is essential for maintaining the integrity of information and preventing unauthorized changes.
  4. Templates and Extensions. MediaWiki supports the use of templates and extensions, allowing users to create standardized layouts and incorporate additional functionalities. This flexibility makes it adaptable to various use cases, from documentation and project management to educational resources.

How to Install MediaWiki on Ubuntu 22.04

Installing MediaWiki on Ubuntu 22.04 involves a series of steps, including setting up a LAMP (Linux, Apache, MySQL, PHP) stack and configuring MediaWiki. Here’s a step-by-step guide to help you through the process.

  1. Update System Packages
  2. Install Apache Web Server
  3. Install MySQL Database Server
  4. Install PHP and Required Modules
  5. Create a Database and User for MediaWiki
  6. Download and Extract MediaWiki
  7. Apache for MediaWiki
  8. Complete the MediaWiki Installation
  9. Secure your MediaWiki Installation
  10. Accessing MediaWiki

The details of MediaWiki installation will be discussed below.

Step 1: Update System Packages

It is recommended if we will add or install new application on the system, we should ensure our system is already updated. For this purpose we will do following command lines :

$ sudo apt update
$ sudo apt upgrade

Step 2: Install Apache Web Server

To Install Apache web server, we will do the following command lines :

$ sudo apt install apache2

Then we will Start and enable Apache web server by submitting following command lines :

$ sudo systemctl start apache2
$ sudo systemctl enable apache2

The detailed installation of Apache web server has been covered on this article.

Step 3: Install MySQL Database Server

To Install MySQL server on the system, we will do following command line :

$ sudo apt install mysql-server

Then Secure your MySQL installation by submitting command line :

$ sudo mysql_secure_installation

The details installation of MySQL server has been covered on this article.

Step 4: Install PHP and Required Modules

MediaWiki requires PHP to run properly, in this step we will install PHP and necessary modules, by submitting command lines :

$ sudo apt install php libapache2-mod-php php-mysql php-cli php-xml php-mbstring

Step 5: Create a Database and User for MediaWiki

In this step, we will create a dedicated database which will be used by MediaWiki application. We will name a new database as mediawiki. For this step we will log in to MySQL database by using root user account.

$ sudo mysql -u root -p

Then we will create a database and user

mysql> CREATE DATABASE mediawikidb;
mysql> CREATE USER 'mediawikiuser'@'localhost' IDENTIFIED BY 'your_password';
mysql> GRANT ALL PRIVILEGES ON mediawikidb.* TO 'mediawikiuser'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> EXIT;

Step 6: Download and Extract MediaWiki

In this step, we will download and extract MediaWiki source file. In this tutorial we will use the latest MediaWiki source file.

Navigate to the Apache web root directory

$ cd /var/www/html

then download the MediaWiki:

$ sudo wget https://releases.wikimedia.org/mediawiki/1.41/mediawiki-1.41.0.tar.gz

Extract the archive :

$ sudo tar -xzvf mediawiki-1.41.0.tar.gz

Rename the extracted directory:

$ sudo mv mediawiki-1.41.0 mediawiki

Step 7: Configure Apache for MediaWiki

In this step we will create a virtual host configuration file which is located at /etc/apache2/sites-available/mediawiki.conf file. We will add the following configuration.

$ sudo vi /etc/apache2/sites-available/mediawiki.conf

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/mediawiki
    ServerName bckinfo

    <Directory /var/www/html/mediawiki/>
        Options FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/mediawiki_error.log
    CustomLog ${APACHE_LOG_DIR}/mediawiki_access.log combined
</VirtualHost>

Then Enable the new virtual host and restart Apache by submitting following command lines :

$ sudo a2ensite mediawiki.conf
$ sudo systemctl restart apache2

Step 8: Complete the MediaWiki Installation

In this step, we will complete the MediaWiki installation. By using web browser we will navigate to http://our_domain_or_ip_address. Follow the on-screen instructions to complete the MediaWiki installation. We will need the database details created in Step 5. Once the installation is complete, remove the install directory:

$ sudo rm -r /var/www/html/mediawiki/install

Step 9: Secure your MediaWiki Installation

For security reasons, we need to set the appropriate permissions:

$ sudo chown -R www-data:www-data /var/www/html/mediawiki

Step 10: Accessing MediaWiki

Our MediaWiki installation should now be accessible at http://our_domain_or_ip_address. We just log in and start creating and managing your collaborative content.

Conclusion

MediaWiki stands as a testament to the power of collaborative knowledge management. Its simplicity, flexibility, and robust features make it an invaluable tool for a wide range of applications, from building comprehensive encyclopedias to managing internal company knowledge. As organizations continue to recognize the importance of shared information and collaborative workflows, MediaWiki remains a frontrunner in the realm of open-source wiki software.

(Visited 30 times, 1 visits today)

Leave a Reply

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