Close
All

How to Install MediaWiki on Ubuntu 22.04 LTS?

  • August 1, 2023
How to Install MediaWiki on Ubuntu 22.04 LTS?

How to Install MediaWiki on Ubuntu 22.04 LTS?

In today’s digital age, the need for collaboration and knowledge sharing has become more crucial than ever. One powerful tool that facilitates this is MediaWiki. MediaWiki is a free and open-source software allowing users to create and edit web-based content collaboratively. In this article, we will explore the step-by-step process of installing MediaWiki on Ubuntu 22.04 LTS, enabling you to create your own knowledge base or wiki platform effortlessly.

What is MediaWiki?

MediaWiki originated from the software behind Wikipedia and is a widely-used wiki software that provides a platform for the collaborative creation and editing of web-based content. It is written in PHP and stores content using a MySQL or MariaDB database. MediaWiki is designed to be highly customizable, making it suitable for a wide range of applications, from personal knowledge management to large-scale enterprise wikis.

Benefits of Using MediaWiki

Before we dive into the installation process, let’s explore why MediaWiki is a popular choice for creating collaborative knowledge platforms.

  • Easy Collaboration: MediaWiki allows multiple users to create and edit content simultaneously, promoting collaboration and knowledge sharing within teams or communities.
  • Structured Content: MediaWiki utilizes a simple markup language that helps maintain consistency and structure within your wiki pages. This makes it easier for users to create organized and searchable content.
  • Version Control: MediaWiki provides built-in version control, allowing users to track changes to wiki pages, revert to previous versions, and monitor contributions.
  • Robust Search Functionality: MediaWiki incorporates an advanced search feature that enables users to efficiently find specific information within a vast collection of wiki pages.
  • Extensibility: MediaWiki supports many extensions that enhance its functionality, such as adding visual editors, multimedia support, or integration with other applications.

Preparing the System

Before installing MediaWiki, we must ensure our system is correctly set up. Follow the steps below to prepare your Ubuntu 22.04 LTS system.

Updating and Upgrading Ubuntu 22.04 LTS

To start, update and upgrade your Ubuntu 22.04 LTS system to ensure you have the latest packages and security patches. Open the terminal and execute the following commands:

sudo apt update
sudo apt upgrade

Installing Apache Web Server

MediaWiki requires a web server to serve its pages to users. We will use Apache as our web server. Install Apache by running the following command:

sudo apt install apache2

Once installed, start the Apache service and enable it to start on system boot:

sudo systemctl start apache2
sudo systemctl enable apache2

Installing MariaDB Database Server

Next, we must install and configure a database server to store MediaWiki’s content. For this guide, we will use MariaDB as our database server. Install MariaDB by executing the following command:

sudo apt install mariadb-server

After the installation completes, start the MariaDB service and enable it to start on system boot:

sudo systemctl start mariadb
sudo systemctl enable mariadb

Installing PHP and Required Extensions

MediaWiki is written in PHP, so we must install PHP and its required extensions. Install PHP and the necessary extensions by running the following command:

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

Restart the Apache service to apply the changes:

sudo systemctl restart apache2

Downloading and Extracting MediaWiki

Now that our system is prepared, we can download and extract MediaWiki. Visit the official MediaWiki website (https://www.mediawiki.org/) and download the latest stable release. Once downloaded, extract the archive to the desired location on your system.

wget https://releases.wikimedia.org/mediawiki/1.36/mediawiki-1.36.3.tar.gz
tar -xf mediawiki-1.36.3.tar.gz

Configuring Apache for MediaWiki

We must create a new virtual host configuration to configure Apache for MediaWiki. Create a new configuration file by running the following command:

sudo nano /etc/apache2/sites-available/mediawiki.conf

In the configuration file, add the following settings:


ServerAdmin admin@example.com
DocumentRoot /var/www/html/mediawiki
ServerName your_domain_or_ip


Options +FollowSymLinks
AllowOverride All
Require all granted


ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

Save the file and exit the text editor. Enable the virtual host configuration and restart Apache:

sudo a2ensite mediawiki.conf
sudo systemctl restart apache2

Creating a Database for MediaWiki

Next, we need to create a database and user for MediaWiki. Access the MariaDB root user by running the following command:

sudo mysql -u root

Once inside the MySQL shell, create a new database and user, and grant the necessary privileges. Replace your_database, your_user, and your_password with your desired values:

CREATE DATABASE your_database;
CREATE USER 'your_user'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL ON your_database.* TO 'your_user'@'localhost';
FLUSH PRIVILEGES;

Exit the MySQL shell by typing exit.

Running the MediaWiki Installation Script

Now that everything is set up open a web browser and access your MediaWiki installation by navigating to http://your_domain_or_ip. You will be greeted with the MediaWiki installation page.

Follow the on-screen instructions to configure your installation. When prompted for database details, enter the name, user, and password you created earlier. Complete the installation process by filling in the necessary information.

Configuring MediaWiki

After the installation completes, you can customize the appearance and behavior of your MediaWiki installation. Log in to your MediaWiki dashboard by clicking the “Log in” link and entering the admin credentials you specified during installation.

You can modify settings, customize the interface, add extensions, and manage user permissions from the dashboard. Take your time to explore the various options and tailor your MediaWiki instance to your needs.

Customizing the Appearance of MediaWiki

To make your MediaWiki installation visually appealing, you can customize its appearance by modifying the theme and layout. MediaWiki provides the flexibility to choose from various themes or create your own. You can add logos, change color schemes, and customize the user interface to match your branding or preferences.

Configuring User Permissions

MediaWiki allows you to control the access and permissions of various users or user groups. Depending on the scope of your wiki platform, you can define permissions for creating, editing or deleting pages. Additionally, you can assign different roles to users, such as administrators or moderators, who have additional privileges.

Adding Extensions to MediaWiki

One of the strengths of MediaWiki is its extensibility. An extensive collection of extensions is available that enhance your wiki’s functionality. You can add attachments for features such as a visual editor, image galleries, code highlighting, or social media integration. Install and configure the extensions that suit your requirements to extend the capabilities of your MediaWiki installation.

Configuring Security Measures

Securing your MediaWiki installation is essential to protect it from potential vulnerabilities or unauthorized access. Best practices include keeping MediaWiki current, using strong passwords, enabling SSL/TLS for secure communication, regularly backing up your data, and employing plugins or configuration settings to strengthen security.

Backing Up and Restoring MediaWiki

Regular backups of your MediaWiki installation are crucial to prevent data loss or system failures. Implement a backup strategy covering your MediaWiki files and the associated database. This will allow you to restore your wiki platform quickly in case of accidental data loss or hardware issues.

Troubleshooting Common Issues

During the installation and configuration process, you may encounter some common issues. Common problems include permission errors, incorrect database settings, or missing dependencies. Refer to the official MediaWiki documentation, online forums, or consult with the community to find solutions to specific issues you might face.

FAQs

What are the system requirements for running MediaWiki?

MediaWiki has modest system requirements. It can run on most modern systems with a web server, database server, and PHP support. Ensure your system meets the minimum requirements outlined in the official MediaWiki documentation.

Can I install MediaWiki on a different Linux distribution?

Yes, MediaWiki can be installed on various Linux distributions, including Ubuntu, Debian, Fedora, and CentOS. Ensure you follow the relevant instructions and adapt the steps according to your distribution.

Can I use MediaWiki to create a public-facing wiki?

Yes, MediaWiki is commonly used to create publicly accessible wikis, allowing users worldwide to contribute and access information. However, proper security measures should be implemented to prevent vandalism or unauthorized access.

Can I migrate an existing wiki to MediaWiki?

Yes, it is possible to migrate an existing wiki to MediaWiki. MediaWiki provides tools and import scripts for this purpose. Consult the official MediaWiki documentation for detailed instructions on how to perform a migration.

Is it possible to integrate MediaWiki with other applications or services?

Yes, MediaWiki supports integration with various external applications and services through extensions or custom development. Integrations with content management systems, single sign-on solutions, or version control systems are among the possibilities. Consult the official MediaWiki documentation or community resources for specific integration guides.

Conclusion

MediaWiki is a powerful tool that allows users to create collaborative knowledge platforms effortlessly. Following the step-by-step guide in this article, you should now have a functioning MediaWiki installation on your Ubuntu 22.04 LTS system. Enjoy the benefits of collaborative content creation, organized knowledge management, and efficient information sharing with MediaWiki.

READ MORE: Migrate From JavaScript to TypeScript

Leave a Reply

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